PyPy 4.0 is a new major version of Python Just-in-Time compiler, bringing many new features, such as SIMD vectorization support, warmup time improvements, and improvements to Numpy. PyPy claims to be more than six times faster than CPython.
PyPy 4 SIMD vectorization takes place while tracing running code and automatically detects availability of SIMD hardware to enhance common vector and matrix operations. According to the announcement, just-in-time vectorization has some advantages over ahead-of-time vectorization in that it can more easily detect possible vectprizations.
On the performance front, PyPy internals were refactored to more efficiently use guards, which brings a 20% memory consumption reduction, and improve unrolling, which reduces warmup time by 20%.
Numpy is PyPy equivalent of Python’s NumPy extension. Python’s NumPy has been mentioned as one of the reason taking back more developers from using PyPy. In PyPy 4.0, Numpy brings extended support for ndarray
and numeric dtypes
, which are deemed close to feature-complete. Support for record
, string
and unicode dtypes
has also improved.
PyPy 4.0 aims to be compliant with CPython 2.7. Lack of support for Python 3 is often considered a limiting factor for PyPy adoption. In fact, PyPy3 is compatible with Python 3.2.5, and the PyPy team is trying to kickstart Python 3.4 support.
Other two factors that should be taken into consideration before moving to PyPy are the lack of equivalent implementations for several C Python extensions such as Pandas, SciPy, etc., which can make CPython be faster than PyPy when such extensions are used; additionally, PyPy brings most of its JIT compiler advantages with long running scripts, while for simple and small scripts, warmup times may slow it down.
More details about PyPy 4.0 can be found in its announcement. PyPy 4 can be downloaded here.