HeadlinesBriefing HeadlinesBriefing.com

Python 3.15 Performance Benchmark Results

Hacker News •
×

It's October once again, and that means it is time to take the new release of Python for a spin (technically, it is the 3.15.0rc3 release that I'm using, the official 3.15 release is still a few days out). As I did with my Python 3.14 performance article of a year ago, today I'm sharing a new run of my informal Python benchmark, comparing Python 3.15 against previous interpreters all the way back to 3.10. If you are not interested in the charts and the tables and just want to read my analysis, feel free to jump to the conclusions section at the end.

The benchmark I just called my benchmark "informal". What does that mean? Getting an objective and universal measure of the performance of a programming language is impossible. All you can do is write some programs and run them to get a measure of their performance.

Other programs may show similar performance characteristics or they may not, there is really no way to know. My intention with this benchmark is just to get a feel for the performance changes across versions of Python, but I want to make it clear that I'm not trying to obtain a comprehensive performance profile of the Python interpreter. For my benchmark I will be running two programs called fibo.py and bubble.py, which you can inspect if you like.

These are the same programs I used in past editions of this benchmark. The first calculates numbers from the Fibonacci sequence, and the second sorts numbers using the bubble sort algorithm. I've chosen these two programs as representative of two classes of algorithms.

The Fibonacci calculation is done using recursion, which I have found to be somewhat inefficient in Python interpreters. On the other side, the bubble sort only uses for-loops, without any recursion. There are other types of programs that my benchmark does not attempt to cover.

In particular, note that I'm not including I/O bound code in this benchmark. Because some of the performance improvements in recent Python versions revolve around multi-threading, I also created a multi-threaded variation for each program, so in total I have four different tests. The testing matrix The complete testing matrix is actually fairly complex, because I have to run the four program variations under all the Python versions, plus the JIT and free-threading alternatives for those that have them.

I like to run the tests under Py Py as well, because this interpreter has shown impressive performance in past runs of this benchmark. And to place Python performance within the wider ecosystem, I've also ported the two programs to Java Script (Node.js) and Rust. Here is the full test matrix that I've worked with: 2 test scripts: fibo.py: calculates Fibonacci numbers, with recursion; bubble.py: sorts a list of randomly generated numbers, without recursion. 2 threading modes: Single-threaded; 4 parallel threads. 6 Python versions, plus recent versions of Py Py, Node.js and Rust: CPython 3.10, 3.11, 3.12, 3.13, 3.14, 3.15; Py Py 3.12; Node 26.3; Rust 1.97. 3 Python interpreters: Standard; Just-In-Time (JIT): only for CPython 3.13+; Free-threading (FT): only for CPython 3.13+.

Readers of my previous benchmarks may recall that I had an additional dimension in my matrix for Linux vs. mac OS. Given that there were no significant differences between them in the two previous runs of the benchmark, I've decided to drop the mac OS tests this time around, so all tests were executed on my Linux laptop, which has an Intel Core i5 CPU and runs Gentoo Linux. The method I'm using to measure the performance of each participant in this benchmark is to run the test program three times and take the average duration of the three.

In the tables of results that I share below I also show the speed difference versus the 3.15 version, and when it makes sense also the speed difference versus the previous version of a given interpreter. For speed comparisons I'm using a simple ratio, where 1x means same speed, 0.5x means half speed (or that it took twice the time to run), 2x means twice as fast.

Source: Hacker News · Summarized by HeadlinesBriefing