Microsoft Pyjion boosts Python speed

The new JIT technology for Python is backward-compatible and works directly with CPython extension modules

Microsoft Pyjion boosts Python speed
Credit: Thinkstock

A new open source Microsoft project, Pyjion, improves the Python language's speed by augmenting its stock interpreter with a JIT derived from Microsoft's CoreCLR project.

Python's standard-issue runtime, CPython, only interprets the bytecode of Python apps and does not accelerate by compiling the code in any way. One common method to speed up Python is to replace CPython entirely. PyPy, a popular CPython replacement, employs a JIT compiler to accelerate Python applications.

PyPy provides a hefty speed boost to many applications, but not all of them, and it sometimes even delivers worse performance than CPython. It also doesn't have the best support for CPython extension modules, which are widely used in Python applications like scientific computing; thus, some of the most avid Python users can't leverage PyPy at all.

Pyjion takes a different approach. It adds a JIT API to CPython, so multiple JITs can be plugged directly into CPython. Since CPython is still in use, apps run as normal, including those that rely on extension modules.

Also, Pyjion targets Python 3, where other Python-acceleration projects have largely favored Python 2. PyPy supports Python 3, but only Python 3.2, so many language constructions added since then (such as async/await) won't work.

Microsoft claims Pyjion's approach is more flexible, since the JIT component is treated a pluggable resource. The choice of a JIT based on CoreCLR isn't meant to be the only option, but rather it serves as a proof-of-concept. According to the documentation on GitHub, Microsoft hopes this will "lead to a proliferation of JIT runtimes for Python, allowing people to choose a JIT that best fits their workload."

Microsoft contributes to existing open source projects via mostly indirect support of its own efforts. Its contributions to the Linux kernel, for instance, were mainly about making Linux a first-class citizen in Azure. But its language work has been slightly more open-ended, and if Pyjion finds traction it'll be one of the biggest contributions Microsoft has made to the ecosystem of a language it previously had no direct hand in.

From CIO: 8 Free Online Courses to Grow Your Tech Skills
Notice to our Readers
We're now using social media to take your comments and feedback. Learn more about this here.