Serdar Yegulalp
Senior Writer

Microsoft’s Pyjion compiler for Python reaches 1.0

news
Nov 9, 20212 mins

A Microsoft project to JIT-compile Python for speed, now under new developers, has reached a milestone.

Pyjion, a just-in-time (JIT) compilation system for Python that compiles to the .NET 6 runtime, is now available in a 1.0 version.

Pronounced “pigeon,” and developed by Python Software Foundation fellow and Microsoft fellow Anthony Shaw (as a fork from its original Microsoft codebase), Pyjion is not a standalone runtime like PyPy, but an installable library that runs under Python 3.10. Once installed, Pyjion can be used in a program simply by importing the Pyjion library and enabling it. Everything that runs after that statement is JIT-compiled.

Pyjion works by compiling Python virtual machine opcodes into assembly language by way of the .NET EE compiler. Benchmarks conducted by the project’s maintainers show that Pyjion is about two to three times faster than regular Python for real-world work. Some of the optimizations allow speedups of up to 10 times. Regular arithmetic, always a good candidate for being JIT-optimized, can be an order of magnitude faster.

Some Python features are not implemented yet in Pyjion, such as with blocks and async/await, but both are on the roadmap. Pyjion does include a middleware layer to allow WSGI applications to run under Pyjion. A long-running application like a web app is a good candidate for JIT acceleration.

It has historically been difficult to make Python faster for a whole slew of reasons. Most methods for speeding up Python still rely on the Python C API for compatibility, so performance can end up being limited by that. Cython, the project that compiles Python into C, achieves its best performance with code that has no reliance on the Python C API at all.

Although Pyjion still relies on the Python C API, its current and future-planned optimizations (e.g., optimizing access to array types) show that its developers are thinking about how to deal with that.

Serdar Yegulalp

Serdar Yegulalp is a senior writer at InfoWorld. A veteran technology journalist, Serdar has been writing about computers, operating systems, databases, programming, and other information technology topics for 30 years. Before joining InfoWorld in 2013, Serdar wrote for Windows Magazine, InformationWeek, Byte, and a slew of other publications. At InfoWorld, Serdar has covered software development, devops, containerization, machine learning, and artificial intelligence, winning several B2B journalism awards including a 2024 Neal Award and a 2025 Azbee Award for best instructional content and best how-to article, respectively. He currently focuses on software development tools and technologies and major programming languages including Python, Rust, Go, Zig, and Wasm. Tune into his weekly Dev with Serdar videos for programming tips and techniques and close looks at programming libraries and tools.

More from this author