BTW, what is mercurial's policy regarding psyco? A try: import psyco psyco.full() # or psyco.bind(...) except ImportError: # or even Exception pass should speed up this kind of code nicely (it sure did speed up my Python Ascii85 implementation)