Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
Programming Python

See the PyPy JIT In Action 109

derGoldstein writes "Project PyPy is an alternative implementation of Python, with the main advantage being a Just In Time (JIT) compiler which speeds up your code considerably. They've announced the first public release of jitviewer, which is a visualization tool that helps you understand how your code is being compiled by PyPy's JIT, all the way down to assembly. If you just want to see how it looks and play with it, they've set up an online demo — just select a file, and click 'Show Assembler.'"
This discussion has been archived. No new comments can be posted.

See the PyPy JIT In Action

Comments Filter:
  • Go Pypy! (Score:4, Informative)

    by Anonymous Coward on Saturday August 13, 2011 @07:40PM (#37081770)

    I love python, and pypy makes dream about the day python could be used for anything, making java irrelevant.
    The language is readable, flexible, succinct, expressive and beautiful.
    Programming in python is more a joy than a core, but it has always suffered from a wide performance gap in cpu intensive tasks compared to traditional static languages.
    Hopefully, this is all about to change with projects like this.
    It's worth noting that Pypy is more than just an alternative python implementation. It is a framework for implementing jitted compiled dynamic languages.
    There are currently several works in progress with implementations of javascript, scheme, logo, php and other languages with pypy.

  • Woo hoo! (Score:4, Informative)

    by 93 Escort Wagon ( 326346 ) on Saturday August 13, 2011 @07:53PM (#37081822)

    I'm glad to see it scales well!

  • by Anonymous Coward on Saturday August 13, 2011 @08:39PM (#37082006)

    umm?!? whoosh?

  • Faster than C? (Score:4, Informative)

    by lee1 ( 219161 ) <lee@lee- p h i l l i p s . org> on Sunday August 14, 2011 @12:50AM (#37082974) Homepage

    Not just faster than CPython, but faster than C [blogspot.com] for some common tasks. Pretty amazing.

    However, this project is not yet very useful to the people who might be most interested in a really fast python, as it does not work with numpy [blogspot.com]. But when they get that to work, wow.

  • by Animats ( 122034 ) on Sunday August 14, 2011 @12:51AM (#37082980) Homepage

    It's an impressive effort that they were able to get this to work at all. Python is really tough to optimize. All bindings are changeable at any time, even from another thread. (The latter is silly, but since it doesn't cost anything to do that in CPython, which is an inefficient naive interpreter that can only run one thread at a time and spends much of its time doing dictionary lookups. Von Rossum defines the language by what CPython can do. There's a huge speed penalty for allowing such extreme dynamism, about 60x over C/C++. The Google team tried to fix that with Unladen Swallow, but gave up when their JIT system was barely faster than CPython.)

    PyPy's most effective optimization to date is that it figures out when numbers don't have to be boxed. This allows generating numeric machine code, rather than grinding through the object machinery for every number. They have to be prepared to discard code when something binding gets changed. This requires a very complex system, involving two interpreters (regular and backup) as well as the JIT compiler.

    The PyPy crowd is at last starting on the tougher optimizations, like hoisting some operations out of loops. (FORTRAN compilers were doing this in the 1960s.) That's real progress, but it's very hard to do in such a dynamic language.

    Many of the optimizations involve generating run-time code that checks to see if the normal case is occurring, and that no other code has patched the code or changed the data from the outside in a way that invalidates the fast path. Then there's code to unwind what the fast path was doing, and interpret or recompile. Most such code is never executed.

For God's sake, stop researching for a while and begin to think!

Working...