Thursday, May 9, 2013

PyPy 2.0 - Einstein Sandwich

We're pleased to announce PyPy 2.0. This is a stable release that brings a swath of bugfixes, small performance improvements and compatibility fixes. PyPy 2.0 is a big step for us and we hope in the future we'll be able to provide stable releases more often.

You can download the PyPy 2.0 release here:

http://pypy.org/download.html

The two biggest changes since PyPy 1.9 are:

  • stackless is now supported including greenlets, which means eventlet and gevent should work (but read below about gevent)
  • PyPy now contains release 0.6 of cffi as a builtin module, which is preferred way of calling C from Python that works well on PyPy

If you're using PyPy for anything, it would help us immensely if you fill out the following survey: http://bit.ly/pypysurvey This is for the developers eyes and we will not make any information public without your agreement.

What is PyPy?

PyPy is a very compliant Python interpreter, almost a drop-in replacement for CPython 2.7. It's fast (pypy 2.0 and cpython 2.7.3 performance comparison) due to its integrated tracing JIT compiler.

This release supports x86 machines running Linux 32/64, Mac OS X 64 or Windows 32. Windows 64 work is still stalling, we would welcome a volunteer to handle that. ARM support is on the way, as you can see from the recently released alpha for ARM.

Highlights

  • Stackless including greenlets should work. For gevent, you need to check out pypycore and use the pypy-hacks branch of gevent.
  • cffi is now a module included with PyPy. (cffi also exists for CPython; the two versions should be fully compatible.) It is the preferred way of calling C from Python that works on PyPy.
  • Callbacks from C are now JITted, which means XML parsing is much faster.
  • A lot of speed improvements in various language corners, most of them small, but speeding up some particular corners a lot.
  • The JIT was refactored to emit machine code which manipulates a "frame" that lives on the heap rather than on the stack. This is what makes Stackless work, and it could bring another future speed-up (not done yet).
  • A lot of stability issues fixed.
  • Refactoring much of the numpypy array classes, which resulted in removal of lazy expression evaluation. On the other hand, we now have more complete dtype support and support more array attributes.

Cheers,
fijal, arigo and the PyPy team


7 comments:

  1. I read this as gevent needs a special branch but eventlet doesn't. Is that correct, or does eventlet require you to use that branch as well?

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Congrats guys! Thanks so much for all your hard work. Python is awesome, and PyPy makes it more awesome!

    ReplyDelete
  4. Are we going to get lazy expression evaluation in numpypy back sometime?

    ReplyDelete
  5. Another thing that's new, is that cppyy is enabled, albeit that you need to install the Reflex library separately. See (Linux only, sorry): http://doc.pypy.org/en/latest/cppyy.html#installation

    ReplyDelete
  6. I'd not say eventlet just works. In this example: http://eventlet.net/doc/examples.html#web-crawler I keep receiving:

    File "/usr/lib/pypy/lib-python/2.7/socket.py", line 430, in read
    data = self._sock.recv(left)
    File "/home/divius/Projects/!demo/eventlet/env/site-packages/eventlet/greenio.py", line 251, in recv
    return fd.recv(buflen, flags)
    File "/usr/lib/pypy/lib-python/2.7/socket.py", line 188, in recv
    return self._sock.recv(buffersize, flags=flags)
    error: [Errno 9] Bad file descriptor

    ReplyDelete
  7. See https://bugs.pypy.org/issue1492. This was reported and we believe we fixed it on trunk.

    ReplyDelete

See also PyPy's IRC channel: #pypy at freenode.net, or the pypy-dev mailing list.
If the blog post is old, it is pointless to ask questions here about it---you're unlikely to get an answer.