How fast is Python 3.15?
In October, Python 3.15.0rc3 reached its final release, prompting a review of its performance compared to previous versions. To assess these improvements, a benchmark consisting of two programs - fibo.py, which calculates Fibonacci numbers using recursion, and bubble.py, which sorts numbers with a bubble sort algorithm - was conducted.
The benchmark also included multi-threaded variations of these programs, as well as tests run on PyPy and in JavaScript (Node.js) and Rust. The tests were executed on a Linux laptop with an Intel Core i5 CPU.
The benchmark results showed that Python 3.15 was slightly faster than 3.14, but the improvement was minimal. PyPy 3.12 demonstrated impressive performance, being 5.5x faster than Python 3.15, and nearly matching Node.js. The same pattern was observed in Rust, with no surprises. When comparing each Python release to its predecessor, Python 3.11 and 3.14 were the only versions to show significant performance improvements. Other releases maintained their speed or made minor advancements.
The JIT (Just-In-Time) and free-threading (FT) releases of Python showed more exciting results. The 3.15 interpreter outperformed its standard counterpart, achieving a 1.20x speed increase. Free-threading interpreter's performance was almost identical to Python 3.14's. The second test, a single-threaded bubble sort, also revealed that Python 3.15 had a slight performance advantage over 3.14, with PyPy remaining highly efficient. However, Node.js was faster than Python in this instance.
Written by urgent.news from Lobsters's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.