PyPy – a faster Python |
Written by Alex Denham | |||
Friday, 26 September 2014 | |||
PyPy 2.4, aka Snow White, has been released with significant performance enhancements and bug fixes.
PyPy already has a reputation as being the way to get better performance from Python programs, running code an average of six times faster than the ‘standard’ Python interpreter. One of the main reasons for this performance improvement is PyPy’s use of a JIT (Just In Time) compiler. According to comparison performance tests on the PyPy Speed Center, the average improvement over CPython for the new version is 6.6 times faster, though they do point out the actual improvement depends greatly on the type of task being performed.
The improvement in performance comes courtesy of internal enhancements in string and bytearray handling, and a major rewrite of the GIL handling, according to the release documentation, which says that that external calls are now a lot faster, especially the CFFI ones. It also means better performance in a lot of corner cases with handling strings or bytearrays. The new version of PyPy has been developed under the code name Snow White, and as well as the improvements in performance has a number of bug fixes. It also supports Python's 2.7.8 standard library. The main bug fix is to the handling of socket objects. These were responsible for memory leaks over the long run in programs, but no longer do so. Another memory leak, this time in I/O in the sandbox code, has also been fixed. Other bug fixes were those reported by users, including tweaks to the internal structure of StringBuilder to speed up large string handling. This has slightly slowed smaller benchmark programs, but will prove advantageous for large programs. The performance of thread-local variables in both unjitted and jitted code has been boosted. This this mostly affects errno handling on linux, which makes external calls faster. Another improvement is a move to a mixed polling and mutex GIL model that make mutlithreaded code compiled using JIT run much faster. The GIL serializes multiple thread access to the Python interpreter, and has been a major cause of Python’s slow performance. For Python enthusiasts, one drawback to PyPy is the fact it doesn’t support Python 3, though developers are working on making that possible and has a fund raising campaign on its website.
More InformationRelated ArticlesMicro Python - The Latest Python Python Tools for Visual Studio 2.1 Beta
To be informed about new articles on I Programmer, install the I Programmer Toolbar, subscribe to the RSS feed, follow us on, Twitter, Facebook, Google+ or Linkedin, or sign up for our weekly newsletter.
Comments
or email your comment to: comments@i-programmer.info |
|||
Last Updated ( Wednesday, 04 February 2015 ) |