Search code examples
pythonperformancejitpypy

PyPy and CPython: are big performance increases planned?


While I know projects promising large speed gains can result in let downs, I don't see much in the way of a roadmap for speeding up CPython and/or PyPy.

Is there something planned that promises a huge boost in speed for the core interpreter (e.g. --with-computed-gotos) in either of them? How about their standard libraries (e.g. Decimal in C, IO in C)?

I know HotPy(2) has an outline of a plan for speeding CPython up, but it sounds like an one-man project without much traction in core CPython.

PyPy has some information about where performance isn't great, but I can find no big goals for speedup in the docs.

So, are there known targets that could bring big performance improvement for Python implementations?


Solution

  • I'll answer the part about PyPy. I can't speak for CPython, but I think there are performance improvements that are being worked on (don't quote me on this though).

    There is no project plan, since it's really not working that way. All the major parts (like "JIT" or "Garbage Collection") has been essentially done, however that completely does not mean everything is fast. There are definitely things that are slow and we generally improve on a case by case basis - submit a bug report if you think something is too slow. I have quite a few performance improvements on my plate that would definitely help twisted, but I have no idea about others.

    Big things that are being worked on that might be worth mentioning:

    • Improved frames, that should help recursion and function calls that are not inlined (for example that contain loops)

    • Better string implementations for various kinds of usages, like concatenation, slicing etc.

    • Faster tracing

    • More compact tuples and objects, storing unwrapped results

    Can I promise when how or how much it'll speed up things? Absolutely not, but on average we manage to have 10-30% speed improvements release-to-release, which is usually every 4 months or so, so I guess some stuff will get faster, but without you giving me a crystal ball or a time machine, I won't tell you for sure.

    Cheers, fijal