Fundamentals 7 min read

Improving Python Performance: Overview of PyPy, Pyston, Nuitka, Cython, and Numba

Although Python runs slower than C or Java, this article explains why it is slower, outlines two general approaches to speed it up, and reviews five concrete projects—PyPy, Pyston, Nuitka, Cython, and Numba—that aim to boost Python performance on various hardware.

Python Programming Learning Circle
Python Programming Learning Circle
Python Programming Learning Circle
Improving Python Performance: Overview of PyPy, Pyston, Nuitka, Cython, and Numba

Python's execution speed is indeed slower than C or Java, but several projects are working to make Python faster.

Python code is concise and clean, yet it is widely recognized as relatively slow—especially for CPU‑intensive tasks where it lags behind C, Java, and JavaScript (although most services are not CPU‑bound). Some teams strive for a perfect Python, so they attempt to improve its performance from the inside out.

If you want Python to run faster on specific hardware, you have at least two options, each with drawbacks: (a) create an alternative Python runtime, which essentially means rewriting CPython; (b) rewrite parts of existing code to leverage performance‑optimizing features, which requires extra effort from developers.

Below are five existing solutions that can help you improve Python performance.

PyPy

Among CPython alternatives, PyPy is the most prominent (e.g., Quora uses it in production). It has a high chance of becoming the default interpreter and is highly compatible with existing Python code. PyPy uses Just‑In‑Time (JIT) compilation to accelerate Python, a technique also employed by Google in the V8 engine for JavaScript. Recent versions (e.g., PyPy 2.5) added performance‑enhancing features, including integration with NumPy, which was previously a separate acceleration path. Python 3 code must be run with PyPy3; currently PyPy supports up to Python 3.2.5, with Python 3.3 support in progress.

Pyston

Pyston, funded by Dropbox, uses the LLVM compiler infrastructure and JIT compilation to speed up Python. Compared with PyPy, Pyston is still in an early stage and supports only a subset of Python features. Its development is split into two parts: the core language features and performance improvements to reach acceptable levels. Pyston is not yet ready for production use.

Nuitka

Some teams try converting Python code into other languages that run efficiently on native hardware. Nuitka is a well‑known project that translates Python code into C++ while still relying on the Python runtime. This limits portability, but the performance gains are noticeable. Long‑term plans include allowing C code to call Nuitka‑compiled Python, which would further improve speed.

Cython

Cython is a superset of Python that compiles Python code to C and enables interaction with C/C++. It can be used to write high‑performance extensions for Python projects or as a standalone tool, though the resulting code is no longer pure Python and requires manual migration, reducing portability. Cython offers features such as variable typing, which can make code significantly faster; many scientific packages (e.g., scikit‑learn) rely on these capabilities.

Numba

Numba combines ideas from the projects above. It adopts some acceleration strategies from Cython, focusing on CPU‑intensive tasks, and also learns from PyPy and Pyston by using LLVM to run Python. Developers can decorate functions with @numba.jit to compile them. Numba inherits NumPy for array operations but does not perform JIT compilation; its code is pre‑compiled.

Guido van Rossum notes that most applications perceived as slow simply misuse Python. For CPU‑intensive workloads there are many ways to improve performance—using NumPy, calling external C code, and minimizing the impact of the GIL. Because the GIL cannot yet be removed, many projects explore short‑term alternatives that may evolve into long‑term solutions.

PerformanceNumbaCythonPyPynuitkapyston
Python Programming Learning Circle
Written by

Python Programming Learning Circle

A global community of Chinese Python developers offering technical articles, columns, original video tutorials, and problem sets. Topics include web full‑stack development, web scraping, data analysis, natural language processing, image processing, machine learning, automated testing, DevOps automation, and big data.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.