Python Programming Language Gets Fast Speed Boost By PyPy Interpreter

By Kimberly Cook |Email | May 16, 2019 | 5982 Views

Good news for Python developers, thanks to a new release of the already speedy PyPy interpreter that promises to be the fastest version yet.

If you're programming using Python then an important choice is whether to run your code using the main CPython interpreter or an alternative such as PyPy, with each option having pros and cons.

PyPy's USP is its speed, with its integrated Just In Time (JIT) compiler allowing it to run some Python code some 7.6 times faster than CPython according to benchmarks.
The latest release of PyPy, v7.1, boosts performance further, by shifting to more efficient representation of text, specifically by switching to using UTF-8 internally to represent Unicode.

There are various other speed improvements under the hood, such as better performance when handling long types and tweaks to the JIT compiler to improve how it allocates data to processor registers, the fast memory that sits on computer CPUs.

More details on the various other changes and fixes in the release are available here and PyPy 7.1 is available to download from here.

If you're wondering whether to try PyPy, the team behind it say the speed boost should be most evident "when executing long-running programs where a significant fraction of the time is spent executing Python code".
That performance advantage won't kick in, however, in the case of short-running processes and where you're using Python to call software libraries written in C.

The team behind PyPy also tout the fact memory usage can be lower than when using CPython, PyPy's support for the enhanced Python variant stackless, and its prototype sandboxing for running untrusted user programs.

The latest release of PyPy includes an interpreter for both Python 2.7 and Python 3.6. However, a disadvantage of PyPy is that its interpreter support for the newer Python 3 is still in beta, with the team warning the "PyPy3.6 release is still not production quality". Also, where your Python code relies on calling C extensions, PyPy's official docs warn these extensions may "need to be recompiled for PyPy in order to work".

Source: HOB