Follow us on RSS or Twitter for the latest updates.

August 19, 2011

Pypy 1.6 Released: Alternative Implementation of Python 2.7.1


Pypy-1.6
The Pypy team has just announced the release of PyPy 1.6. This release brings a lot of bugfixes and performance improvements over 1.5, and improves support for Windows 32bit and OS X 64bit. This version fully implements Python 2.7.1 and has beta level support for loading CPython C extensions.

What is PyPy?

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

This release supports x86 machines running Linux 32/64 or Mac OS X. Windows 32 is beta (it roughly works but a lot of small issues have not been fixed so far). Windows 64 is not yet supported.

The main topics of this release are speed and stability: on average on our benchmark suite, PyPy 1.6 is between 20% and 30% faster than PyPy 1.5, which was already much faster than CPython on our set of benchmarks.

The speed improvements have been made possible by optimizing many of the layers which compose PyPy. In particular, we improved: the Garbage Collector, the JIT warmup time, the optimizations performed by the JIT, the quality of the generated machine code and the implementation of our Python interpreter.

Highlights
  • Numerous performance improvements, overall giving considerable speedups
  • JitViewer: this is the first official release which includes the JitViewer, a web-based tool which helps you to see which parts of your Python code have been compiled by the JIT, down until the assembler. The jitviewer 0.1 has already been release and works well with PyPy 1.6.
  • The CPython extension module API has been improved and now supports many more extensions. For information on which one are supported, please refer to our compatibility wiki.
  • Multibyte encoding support: this was of of the last areas in which we were still behind CPython, but now we fully support them.
  • Preliminary support for NumPy: this release includes a preview of a very fast NumPy module integrated with the PyPy JIT. Unfortunately, this does not mean that you can expect to take an existing NumPy program and run it on PyPy, because the module is still unfinished and supports only some of the numpy API. However, barring some details, what works should be blazingly fast :-)
  • Bugfixes: since the 1.5 release we fixed 53 bugs in our bug tracker, not counting the numerous bugs that were found and reported through other channels than the bug tracker.

Download and Install
(Note: windows binary are not available yet)

These binaries include a Just-in-Time compiler. They only work on x86 CPUs that have the SSE2 instruction set (most of them do, nowadays), or on x86-64 CPUs. (This is the official release 1.6; for the most up-to-date version see below.)

If your CPU is really old, it may not have SSE2. In this case, you need to translate yourself with the option --jit-backend=x86-without-sse2.

Notes:

  • It is recommended to use PyPy to do translations, instead of using CPython, because it is twice as fast. You should just start by downloading an official release of PyPy (with the JIT).
  • If RAM usage is a problem, then you can (for now) tweak some parameters via environment variables and command-line options. The following command takes a bit more time, but finishes with only using 3.0 GB of RAM (on Linux 64-bit; probably not much more than 1.5 GB on 32-bit). It should be noted that it is less than with CPython.

PYPY_GC_MAX_DELTA=200MB pypy --jit loop_longevity=300 ./translate.py -Ojit
  • Because of asmgcroot, compiling the generated C files containing the JIT is delicate. It requires using either MSVC or gcc with no particularly fancy options. It does not work e.g. with clang, or if you pass uncommon options with the CFLAGS environment variable. You can also try to compile PyPy with the shadow stack option.

Checksums

Here are the checksums for each of the downloads (md5 and sha1):

ee949986fc5ec5c4a11ecbd546b87fbb    pypy-1.6-linux.tar.bz2
a34e3113508449393e874f409dd888fc    pypy-1.6-linux64.tar.bz2
78bbf70f55e9fec20d7ac22531a997fc    pypy-1.6-osx64.tar.bz2
1bdef4c7adc023033552754258fd02bb63612632    pypy-1.6-linux.tar.bz2
4a42625139351f9a1c2f8d7ec13ff636cfc9d8ac    pypy-1.6-linux64.tar.bz2
d703aa34fe1a45682ce4a09470ee9b1fa873d9be    pypy-1.6-osx64.tar.bz2
Or read more here.