Serdar Yegulalp
Senior Writer

Nuitka Python-to-C compiler readies big performance gains

news
Oct 2, 20182 mins

Nuitka 0.6 lays the groundwork for major code optimizations — and faster and more portable Python applications

speed_digital_car_lights_vehicle_fabio ballasina unsplash
Credit: fabio ballasina

Nuitka, a compiler that transforms Python into C for the sake of both performance gains and a more portable runtime, has reached its 0.6 release—a milestone that lays the groundwork for future performance gains. As Nuitka developer Kay Hayen put it, “Performance improvements are likely in every coming release.”

Nuitka 0.6 applies optimizations to Python’s bool types (true/false), so that code using them can be reduced to the most efficient possible C code. The bool optimizations come as a prelude to similar optimizations for other variable types.

Nuitka, like Cython, compiles a Python program to C, and links the resulting executable against the Python runtime for maximum compatibility. Python versions 2.6, 2.7, and 3.3 through 3.7 are all supported, including constructions like async.

Python programs compiled with Nuitka can benefit from large performance boosts. Hayen claims a Nuitka-compiled version of the Pystone benchmark runs some 312 percent faster than a conventional CPython implementation.

But Hayen warns that the most significant performance improvements await the arrival of type inferencing in Nuitka, enabling the full translation of certain types of Python objects into native C versions.

Python’s dynamism makes many kinds of optimizations inherently difficult. Many Cython optimizations require a great deal of guidance and a specialized annotation syntax for the best results. The Nuitka project aims to provide the same sorts of optimizations without requiring the developer to annotate the code.

Another commonly used Python accelerator, PyPy, works by just-in-time compiling Python code to assembly. But PyPy works best for in-place optimization; it isn’t suited to compiling a Python app that is deployed in a stand-alone fashion. Nuitka generates stand-alone executables. One of its potential use cases is packaging up a Python app for third-party distribution.

Other improvements in Nuitka 0.6 include support on Windows for the Clang, Microsoft Visual C++, and Cygwin compilers, caching of object files for faster recompilation (again, on Windows), and auto-formatting of generated C code in clang-format for readability.

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