Skip to main content

EuroPython

Hi all,

A short note: if you're at EuroPython right now and wondering if PyPy is dead because you don't see the obviously expected talk about PyPy, don't worry. PyPy is still alive and kicking. The truth is two-fold: (1) we missed the talk deadline (duh!)... but as importantly, (2) for various reasons we chose not to travel to Florence this year after our trip to PyCon US. (Antonio Cuni is at Florence but doesn't have a talk about PyPy either.)

Armin

rokujyouhitoma wrote on 2013-07-04 20:25:

I think of it for a moment. >dead.
Also...I can not meet you at EuroPython :(

See you next time!
From Japanese Pythonista.

Py3k status update #11

This is the 11th status update about our work on the py3k branch, which we
can work on thanks to all of the people who donated to the py3k proposal.

Here's some highlights of the progress made since the previous update:

  • PyPy py3k now matches CPython 3's hash code for
    int/float/complex/Decimal/Fraction
  • Various outstanding unicode identifier related issues were
    resolved. E.g. test_importlib/pep263/ucn/unicode all now fully pass. Various
    usage of identifiers (in particular type and module names) have been fixed to
    handle non-ascii names -- mostly around display of reprs and exception
    messages.
  • The unicodedata database has been upgraded to 6.0.0.
  • Windows support has greatly improved, though it could still use some more
    help (but so does the default branch to a certain degree).
  • Probably the last of the parsing related bugs/features have been taken care
    of.
  • Of course various other smaller miscellaneous fixes

This leaves the branch w/ only about 5 outstanding failures of the stdlib test
suite:

  • test_float

    1 failing test about containment of floats in collections.

  • test_memoryview

    Various failures: requires some bytes/str changes among other things (Manuel
    Jacob's has some progress on this on the py3k-memoryview branch)

  • test_multiprocessing

    1 or more tests deadlock on some platforms

  • test_sys and test_threading

    2 failing tests for the New GIL's new API

Probably the biggest feature left to tackle is the New GIL.

We're now pretty close to pushing an initial release. We had planned for one
around PyCon, but having missed that we've put some more effort into the branch
to provide a more fully-fledged initial release.

Thanks to the following for their contributions: Manuel Jacob, Amaury Forgeot
d'Arc, Karl Ramm, Jason Chu and Christian Hudon.

cheers,
Phil

Anonymous wrote on 2013-06-14 12:20:

In my new project I'm using Python3.
I can't when I will run it with PyPy.

Thanks for your work!

Unknown wrote on 2013-06-14 20:29:

I just donated and found this post :) Great work!

Paul Jaros wrote on 2013-06-17 08:12:

The "new GIL" picked my curiosity. Was is it? Is it related to the STM or is it a separate thing?

Also, thanks for the update.

Philip Jenvey wrote on 2013-06-18 19:35:

The new GIL is briefly explained here: https://docs.python.org/3.4/whatsnew/3.2.html#multi-threading

Additionally, David Beazly has done a couple talks/blog posts about the problems of the old GIL and how the new GIL has improved over the old design.

Paul Jaros wrote on 2013-06-19 12:02:

Thanks for the link

randomlessly wrote on 2013-06-22 17:37:

kkk @Tom Li

Unknown wrote on 2013-06-23 09:15:

Will the pre-release already be optimized?

Tony wrote on 2013-07-31 08:36:

This is cool!

STM on the drawing board

Hi all!

This is an update about the Software Transactional Memory subproject of PyPy. I have some good news of progress. Also, Remi Meier will likely help me this summer. He did various investigations with PyPy-STM for his Master's Thesis and contributed back a lot of ideas and some code. Welcome again Remi!

I am also sorry that it seems to advance so slowly. Beyond the usual excuses --- I was busy with other things, e.g. releasing PyPy 2.0 --- I would like to reassure people: I'm again working on it, and the financial contributions are still there and reserved for STM (almost half the money is left, a big thank you again if you contributed!).

The real reason for the apparent slowness, though, is that it is really a research project. It's possible to either have hard deadlines, or to follow various tracks and keep improving the basics, but not both at the same time.

During the past month where I have worked again on STM, I worked still on the second option; and I believe it was worth every second of it. Let me try to convince you :-)

The main blocker was that the STM subsystem, written in C, and the Garbage Collection (GC) subsystem, written in RPython, were getting harder and harder to coordinate. So what I did instead is to give up using RPython in favor of using only C for both. C is a good language for some things, which includes low-level programming where we must take care of delicate multithreading issues; RPython is not a good fit in that case, and wasn't designed to be.

I started a fresh Mercurial repo which is basically a stand-alone C library. This library (in heavy development right now!) gives any C program some functions to allocate and track GC-managed objects, and gives an actual STM+GC combination on these objects. It's possible (though rather verbose) to use it directly in C programs, like in a small example interpreter. Of course the eventual purpose is to link it with PyPy during translation to C, with all the verbose calls automatically generated.

Since I started this, bringing the GC closer to the STM, I kept finding new ways that the two might interact to improve the performance, maybe radically. Here is a summary of the current ideas.

When we run multiple threads, there are two common cases: one is to access (read and write) objects that have only been seen by the current thread; the other is to read objects seen by all threads, like in Python the modules/functions/classes, but not to write to them. Of course, writing to the same object from multiple threads occurs too, and it is handled correctly (that's the whole point), but it is a relatively rare case.

So each object is classified as "public" or "protected" (or "private", when they belong to the current transaction). Newly created objects, once they are no longer private, remain protected until they are read by a different thread. Now, the point is to use very different mechanisms for public and for protected objects. Public objects are visible by all threads, but read-only in memory; to change them, a copy must be made, and the changes are written to the copy (the "redolog" approach to STM). Protected objects, on the other hand, are modified in-place, with (if necessary) a copy of them being made for the sole purpose of a possible abort of the transaction (the "undolog" approach).

This is combined with a generational GC similar to PyPy's --- but here, each thread gets its own nursery and does its own "minor collections", independently of the others.

So objects are by default protected; when another thread tries to follow a pointer to them, then it is that other thread's job to carefully "steal" the object and turn it public (possibly making a copy of it if needed, e.g. if it was still a young object living in the original nursery).

The same object can exist temporarily in multiple versions: any number of public copies; at most one active protected copy; and optionally one private copy per thread (this is the copy as currently seen by the transaction in progress on that thread). The GC cleans up the unnecessary copies.

These ideas are variants and extensions of the same basic idea of keeping multiple copies with revision numbers to track them. Moreover, "read barriers" and "write barriers" are used by the C program calling into this library in order to be sure that it is accessing the right version of the object. In the currently investigated variant I believe it should be possible to have rather cheap read barriers, which would definitely be a major speed improvement over the previous variants. Actually, as far as I know, it would be a major improvement over most of the other existing STMs: in them, the typical read barrier involves following chains of pointers, and checking some dictionary to see if this thread has a modified local copy of the object. The difference with a read barrier that can resolve most cases in a few CPU cycles should be huge.

So, this is research :-) It is progressing, and at some point I'll be satisfied with it and stop rewriting everything; and then the actual integration into PyPy should be straightforward (there is already code to detect where the read and write barriers need to be inserted, where transactions can be split, etc.). Then there is support for the JIT to be written, and so on. But more about it later.

The purpose of this post was to give you some glimpses into what I'm working on right now. As usual, no plan for release yet. But you can look forward to seeing the C library progress. I'll probably also start soon some sample interpreter in C, to test the waters (likely a revival of duhton). If you know nothing about Python but all about the C-level multithreading issues, now is a good time to get involved :-)

Thanks for reading!

Armin

Paul Jaros wrote on 2013-06-06 12:48:

Thanks for the update. I was wondering since some time how the progress in STM has come along.
Good job also :)

Tuure Laurinolli wrote on 2013-06-18 05:27:

Do you have a description of the read and write barriers required somewhere? How does requiring a copy to be made of protected objects upon modification work with e.g. large arrays?

David wrote on 2013-08-04 18:06:

Check out John Carmack's brainstorm on an integrated STM+GC system concept which is sort of "globally phased compacting GC+STM". He doesn't use the term STM, but the concept is the same.

https://www.youtube.com/watch?v=1PhArSujR_A&feature=player_detailpage&t=1354

NumPyPy status update

Hello everyone,

May was the first month I was paid to work on NumPyPy (thanks to all who donated!), here is what I worked on during this period :

  • It is now possible to use subarrays.
  • It is now possible to pickle ndarrays (including those using subarrays), dtypes and scalars, the pickling protocol is the same as numpy's.

For June, I plan to work on the nditer class, it seems that there's enough work for an entire month.

Cheers
Romain Guillebert
Anonymous wrote on 2013-06-03 18:49:

What's numpypy's recommended way for a C/cffi extension to get a pointer to the data?

Thanks,
Andreas

Anonymous wrote on 2013-06-04 08:37:

Excellent work!

Anonymous wrote on 2013-06-04 10:34:

Thanks! But pickling sliced arrays doesn't work yet (tested with nightly build pypy-c-jit-64739-f556942951f9-linux):

import cPickle as pickle
import numpypy as numpy
a = numpy.arange(10.)[::2]
print a # [ 0. 2. 4. 6. 8.]
p = pickle.dumps(a)
print pickle.loads(p) # [ 0. 1. 2. 3. 4.] oops!

Romain Guillebert wrote on 2013-06-04 19:55:

@Anonymous

Thanks for reporting it, it's fixed

Anonymous wrote on 2013-06-04 21:16:

Great to hear about the progress, keep up the good work!

Anonymous wrote on 2013-12-05 22:23:

It is working very well for me, thanks!

Now, is there any way to load the resulting pickle in cPython?

numpy.save and numpy.load do work between pypy and cPython, but my arrays are embedded in larger data structures.

The motivation is that I would like to run a numerical program and store some results, and then load the results and plot them with matplotlib (which does not work on pypy).

Here is the error in cPython:

>>> pickle.load(open('/tmp/x', 'r+b'))
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1124, in find_class
__import__(module)
ImportError: No module named _numpypy.multiarray

Anonymous wrote on 2013-12-05 22:28:

It is working great, thanks!

Now, is there any way to load the resulting pickle in cPython?

numpy.save and numpy.load do work between pypy and cPython, but my arrays are embedded in larger data structures.

The motivation is that I would like to run a numerical program and store some results, and then load the results and plot them with matplotlib (which does not work on pypy).

Here is the error in cPython:

>>> pickle.load(open('/tmp/x', 'r+b'))
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.7/pickle.py", line 1378, in load
return Unpickler(file).load()
File "/usr/lib/python2.7/pickle.py", line 858, in load
dispatch[key](self)
File "/usr/lib/python2.7/pickle.py", line 1090, in load_global
klass = self.find_class(module, name)
File "/usr/lib/python2.7/pickle.py", line 1124, in find_class
__import__(module)
ImportError: No module named _numpypy.multiarray

PyPy 2.0.2 - Fermi Panini

We're pleased to announce PyPy 2.0.2. This is a stable bugfix release over 2.0 and 2.0.1. You can download it here:

https://pypy.org/download.html

It fixes a crash in the JIT when calling external C functions (with ctypes/cffi) in a multithreaded context.

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. Support for ARM is progressing but not bug-free yet.

Highlights

This release contains only the fix described above. A crash (or wrong results) used to occur if all these conditions were true:

  • your program is multithreaded;
  • it runs on a single-core machine or a heavily-loaded multi-core one;
  • it uses ctypes or cffi to issue external calls to C functions.

This was fixed in the branch emit-call-x86 (see the example file bug1.py).

Cheers, arigo et. al. for the PyPy team

Valentin wrote on 2013-07-22 09:12:

This is cool!

PyPy 2.0.1 - Bohr Smørrebrød

We're pleased to announce PyPy 2.0.1. This is a stable bugfix release over 2.0. You can download it here:

https://pypy.org/download.html

The fixes are mainly about fatal errors or crashes in our stdlib. See below for more details.

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. Support for ARM is progressing but not bug-free yet.

Highlights

Cheers, arigo et. al. for the PyPy team

Numpy Status Update

Hello Everyone,

I've started to work on NumPyPy since the end of April and here is a short update :

  • I implemented pickling support on ndarrays and dtypes, it will be compatible with numpy's pickling protocol when the "numpypy" module will be renamed to "numpy".
  • I am now working on subarrays.

I would also like to thank everyone who donated and allowed me to work on this.

Cheers,
Romain Guillebert
Anonymous wrote on 2013-05-12 11:09:

No, thank you! Cannot wait till the day PyPy fully supports NumPy.

Anonymous wrote on 2013-05-13 00:19:

I second the anonymous comment above. The day PyPy fully supports NumPy is the day I switch from CPython.

Paul Jaros wrote on 2013-05-13 08:32:

Aww... Anonymous.

@Romain Guillebert Thank you for the hard work you are putting into it. I will be testing my code with the current release.

Anonymous wrote on 2013-05-13 18:38:

This (and to a lesser extent Python 3 support) is the only thing holding me back from switching to PyPy for all of my python programming. Thank you very much for this fantastic project!

Paul Jaros wrote on 2013-05-14 22:44:

Results from running my own little Benchmark: Labyrinth Generator
Array Size: 77711x711:

C-Code:
4.45 Seconds, ~50M Memory Usage.

Pypy with standard List:
14.5 Seconds, ~750M Memory Usage.

Pypy with Numpypy:
11.0 Seconds, ~78M Memory Usage.

Pretty impressive if you ask me. Older Numpypy where about as fast as the standard List. Also Pypy is approaching C-Performance with bigger steps than I dared hoping for.

CPython Benchmark intentionally left out... it takes ages.

Anonymous wrote on 2013-05-15 14:50:

It's great to see a progress in important libraries support.

Speed is important, but when we get acceptable speed then library support is what we need.

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:

https://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: https://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


Unknown wrote on 2013-05-09 20:01:

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?

Anonymous wrote on 2013-05-10 01:04:

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

Robert wrote on 2013-05-10 13:39:

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

Wim Lavrijsen wrote on 2013-05-10 17:26:

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

Unknown wrote on 2013-07-20 15:24:

I'd not say eventlet just works. In this example: https://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

Armin Rigo wrote on 2013-07-21 22:24:

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

PyPy 2.0 alpha for ARM

Hello.

We're pleased to announce an alpha release of PyPy 2.0 for ARM. This is mostly a technology preview, as we know the JIT is not yet stable enough for the full release. However please try your stuff on ARM and report back.

This is the first release that supports a range of ARM devices - anything with ARMv6 (like the Raspberry Pi) or ARMv7 (like Beagleboard, Chromebook, Cubieboard, etc.) that supports VFPv3 should work. We provide builds with support for both ARM EABI variants: hard-float and some older operating systems soft-float.

This release comes with a list of limitations, consider it alpha quality, not suitable for production:

  • stackless support is missing.
  • assembler produced is not always correct, but we successfully managed to run large parts of our extensive benchmark suite, so most stuff should work.

You can download the PyPy 2.0 alpha ARM release here (including a deb for raspbian):

https://pypy.org/download.html

Part of the work was sponsored by the Raspberry Pi foundation.

What is PyPy?

PyPy is a very compliant Python interpreter, almost a drop-in replacement for CPython 2.7.3. It's fast due to its integrated tracing JIT compiler.

This release supports ARM machines running Linux 32bit. Both hard-float armhf and soft-float armel builds are provided. armhf builds are created using the Raspberry Pi custom cross-compilation toolchain based on gcc-arm-linux-gnueabihf and should work on ARMv6 and ARMv7 devices running at least debian or ubuntu. armel builds are built using gcc-arm-linux-gnuebi toolchain provided by ubuntu and currently target ARMv7. If there is interest in other builds, such as gnueabi for ARMv6 or without requiring a VFP let us know in the comments or in IRC.

Benchmarks

Everybody loves benchmarks. Here is a table of our benchmark suite (for ARM we don't provide it yet on https://speed.pypy.org, unfortunately).

This is a comparison of Cortex A9 processor with 4M cache and Xeon W3580 with 8M of L3 cache. The set of benchmarks is a subset of what we run for https://speed.pypy.org that finishes in reasonable time. The ARM machine was provided by Calxeda. Columns are respectively:

  • benchmark name
  • PyPy speedup over CPython on ARM (Cortex A9)
  • PyPy speedup over CPython on x86 (Xeon)
  • speedup on Xeon vs Cortex A9, as measured on CPython
  • speedup on Xeon vs Cortex A9, as measured on PyPy
  • relative speedup (how much bigger the x86 speedup is over ARM speedup)
Benchmark PyPy vs CPython (arm) PyPy vs CPython (x86) x86 vs arm (pypy) x86 vs arm (cpython) relative speedup
ai 3.61 3.16 7.70 8.82 0.87
bm_mako 3.41 2.11 8.56 13.82 0.62
chaos 21.82 17.80 6.93 8.50 0.82
crypto_pyaes 22.53 19.48 6.53 7.56 0.86
django 13.43 11.16 7.90 9.51 0.83
eparse 1.43 1.17 6.61 8.12 0.81
fannkuch 6.22 5.36 6.18 7.16 0.86
float 5.22 6.00 9.68 8.43 1.15
go 4.72 3.34 5.91 8.37 0.71
hexiom2 8.70 7.00 7.69 9.56 0.80
html5lib 2.35 2.13 6.59 7.26 0.91
json_bench 1.12 0.93 7.19 8.68 0.83
meteor-contest 2.13 1.68 5.95 7.54 0.79
nbody_modified 8.19 7.78 6.08 6.40 0.95
pidigits 1.27 0.95 14.67 19.66 0.75
pyflate-fast 3.30 3.57 10.64 9.84 1.08
raytrace-simple 46.41 29.00 5.14 8.23 0.62
richards 31.48 28.51 6.95 7.68 0.91
slowspitfire 1.28 1.14 5.91 6.61 0.89
spambayes 1.93 1.27 4.15 6.30 0.66
sphinx 1.01 1.05 7.76 7.45 1.04
spitfire 1.55 1.58 5.62 5.49 1.02
spitfire_cstringio 9.61 5.74 5.43 9.09 0.60
sympy_expand 1.42 0.97 3.86 5.66 0.68
sympy_integrate 1.60 0.95 4.24 7.12 0.60
sympy_str 0.72 0.48 3.68 5.56 0.66
sympy_sum 1.99 1.19 3.83 6.38 0.60
telco 14.28 9.36 3.94 6.02 0.66
twisted_iteration 11.60 7.33 6.04 9.55 0.63
twisted_names 3.68 2.83 5.01 6.50 0.77
twisted_pb 4.94 3.02 5.10 8.34 0.61

It seems that Cortex A9, while significantly slower than Xeon, has higher slowdowns with a large interpreter (CPython) than a JIT compiler (PyPy). This comes as a surprise to me, especially that our ARM assembler is not nearly as polished as our x86 assembler. As for the causes, various people mentioned branch predictor, but I would not like to speculate without actually knowing.

How to use PyPy?

We suggest using PyPy from a virtualenv. Once you have a virtualenv installed, you can follow instructions from pypy documentation on how to proceed. This document also covers other installation schemes.

We would not recommend using in production PyPy on ARM just quite yet, however the day of a stable PyPy ARM release is not far off.

Cheers,
fijal, bivab, arigo and the whole PyPy team


Anonymous wrote on 2013-05-08 14:43:

Congratulations!

Anonymous wrote on 2013-05-08 14:43:

Congratulations!

Rasmus wrote on 2013-05-09 12:43:

This is truly amazing! Great work and I'm very interested about the future.

João Magalhães wrote on 2013-05-10 22:48:

This is really great news especially for the raspberry pi guys.

Congratulations !!!

Verona wrote on 2013-07-30 06:19:

This is cool!

xaRD wrote on 2015-01-25 12:13:

Where I get the source code for the benchmark's you have used?

Armin Rigo wrote on 2015-01-26 09:59:

https://foss.heptapod.net/pypy/benchmarks/

PyPy 2.0 beta 2 released

We're pleased to announce the 2.0 beta 2 release of PyPy. This is a major release of PyPy and we're getting very close to 2.0 final, however it includes quite a few new features that require further testing. Please test and report issues, so we can have a rock-solid 2.0 final. It also includes a performance regression of about 5% compared to 2.0 beta 1 that we hope to fix before 2.0 final. The ARM support is not working yet and we're working hard to make it happen before the 2.0 final. The new major features are:

  • JIT now supports stackless features, that is greenlets and stacklets. This means that JIT can now optimize the code that switches the context. It enables running eventlet and gevent on PyPy (although gevent requires some special support that's not quite finished, read below).
  • This is the first PyPy release that includes cffi as a core library. Version 0.6 comes included in the PyPy library. cffi has seen a lot of adoption among library authors and we believe it's the best way to wrap C libaries. You can see examples of cffi usage in _curses.py and _sqlite3.py in the PyPy source code.

You can download the PyPy 2.0 beta 2 release here:

https://pypy.org/download.html

What is PyPy?

PyPy is a very compliant Python interpreter, almost a drop-in replacement for CPython 2.7.3. It's fast (pypy 2.0 beta 2 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. It also supports ARM machines running Linux, however this is disabled for the beta 2 release. Windows 64 work is still stalling, we would welcome a volunteer to handle that.

How to use PyPy?

We suggest using PyPy from a virtualenv. Once you have a virtualenv installed, you can follow instructions from pypy documentation on how to proceed. This document also covers other installation schemes.

Highlights

  • cffi is officially supported by PyPy. It comes included in the standard library, just use import cffi
  • stackless support - eventlet just works and gevent requires pypycore and pypy-hacks branch of gevent (which mostly disables cython-based modules)
  • callbacks from C are now much faster. pyexpat is about 3x faster, cffi callbacks around the same
  • __length_hint__ is implemented (PEP 424)
  • a lot of numpy improvements

Improvements since 1.9

  • JIT hooks are now a powerful tool to introspect the JITting process that PyPy performs
  • various performance improvements compared to 1.9 and 2.0 beta 1
  • operations on long objects are now as fast as in CPython (from roughly 2x slower)
  • we now have special strategies for dict/set/list which contain unicode strings, which means that now such collections will be both faster and more compact.

Anonymous wrote on 2013-04-08 08:30:

why do you ship with pypy sqlite version 3.5.9 (windows version),
this is an old version which doesn't support wal mode

2008-May-12 - Version 3.5.9

Anonymous wrote on 2013-04-08 16:40:

Congratulations! And hope the ARM version of PyPy together with ARM v6 support will also coming soon.

Anonymous wrote on 2013-04-08 17:26:

Can you explain "performance regression of about 5% " and also "various performance improvements compared to 1.9 and 2.0 beta 1"?

What is faster and what is slower?

Anonymous wrote on 2013-04-12 11:59:

And we've got a lot of segfaults with beta2…

Maciej Fijalkowski wrote on 2013-04-12 12:11:

@Anonymous - please report those. It's impossible for us to determine what's going on without reporting back.

Mak Sim wrote on 2013-04-18 10:59:

Thank you for great job.
Do you plan to release 64-bit binaries for Windows?
I'm trying to build from tag "pypy-2.0-beta2" under Windows7 x64, with MSVC compiler AMD-64, and I've got an exception:

[translation:ERROR] TypeError: <Struct PyTypeObject { c_ob_refcnt, c__pad0, c__pad1, c__pad2, c__pad3, c_ob_type, c_ob_size, c__pad4, c__pad5, c__pad6, c__pad7, c_tp_name, c_tp_basicsize, c_tp_itemsize, c_tp_dealloc, c_tp_print, c_tp_getattr, c_tp_setattr, c_tp_compare, c_tp_repr, c_tp_as_number, c_tp_as_sequence, c_tp_as_mapping, c_tp_hash, c_tp_call, c_tp_str, c_tp_getattro, c_tp_setattro, c_tp_as_buffer, c_tp_flags, c__pad8, c__pad9, c__pad10, c__pad11, c_tp_doc, c_tp_traverse, c_tp_clear, c_tp_richcompare, c_tp_weaklistoffset, c__pad12, c__pad13, c__pad14, c__pad15, c_tp_iter, c_tp_iternext, c_tp_methods, c_tp_members, c_tp_getset, c_tp_base, c_tp_dict, c_tp_descr_get, c_tp_descr_set, c_tp_dictoffset, c__pad16, c__pad17, c__pad18, c__pad19, c_tp_init, c_tp_alloc, c_tp_new, c_tp_free, c_tp_is_gc, c_tp_bases, c_tp_mro, c_tp_cache, c_tp_subclasses, c_tp_weaklist, c_tp_del, c__pad20, c__pad21, c__pad22, c__pad23, c__pad24, c__pad25, c__pad26, c__pad27 }> instance field 'c_ob_refcnt':
[translation:ERROR] expects <INT>
[translation:ERROR] got <Signed>

Maciej Fijalkowski wrote on 2013-04-18 11:01:

As it says in the release announcement, win64 is not supported. You need to build a 32bit binary (using 32bit Python)

Egypt News wrote on 2013-04-22 05:04:

great news, waiting for the final v2.0