Python Interpreters Benchmarks
x64 ArchLinux : AMD® Ryzen 7 4700U®

 binary-trees benchmark N=14

Each chart bar shows how many times slower, one ↓ binary-trees program was, compared to the fastest program.

These are not the only programs that could be written. These are not the only compilers and interpreters. These are not the only programming languages.

Column × shows how many times more each program used compared to the benchmark program that used least.

    sort sortsort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0Python development version #7 1.020.20?741  68% 75% 62% 67% 65% 63% 67% 63%
1.2Nuitka 1.160.23716706  61% 83% 61% 58% 61% 60% 62% 62%
1.2Python development version 1.240.252,388706  65% 67% 67% 65% 58% 61% 62% 80%
1.2Nuitka #7 1.040.25716741  48% 82% 46% 50% 58% 48% 43% 50%
1.3Python development version #6 1.380.262,072743  65% 67% 62% 84% 65% 68% 65% 64%
1.3Pyston #7 1.170.271,268741  82% 68% 59% 63% 69% 64% 65% 62%
1.4Nuitka #6 1.400.271,528743  67% 63% 83% 62% 59% 59% 59% 59%
1.4Python 3 #7 1.460.291,620741  69% 67% 79% 61% 68% 71% 64% 62%
1.5Python 3 1.610.311,892706  81% 70% 66% 77% 68% 63% 62% 65%
1.7Pyston #6 1.640.351,268743  70% 86% 68% 68% 71% 69% 66% 71%
1.7Python 3 #6 1.830.351,832743  74% 71% 71% 69% 69% 60% 65% 86%
2.3Python 2 2.020.4716,340743  54% 57% 56% 54% 64% 57% 63% 54%
2.4Pyston 1.670.4916,032743  66% 57% 58% 54% 58% 64% 65% 63%
4.9PyPy 3 2.810.9990,520706  30% 67% 26% 35% 31% 33% 30% 32%
4.9PyPy 3 #6 2.930.9990,952743  31% 71% 32% 29% 36% 34% 26% 31%
5.2PyPy 2 2.291.0692,236743  30% 29% 27% 24% 26% 67% 21% 23%
5.6PyPy 3 #7 2.261.14135,952741  28% 49% 19% 13% 27% 27% 27% 25%
315Numba 5 min63.59154,632734  73% 70% 76% 94% 76% 74% 69% 75%
missing benchmark programs
Jython No program
IronPython No program
Cython No program
Shedskin No program
MicroPython No program
Grumpy No program
Graal No program
RustPython No program

 binary-trees benchmark : Allocate and deallocate many many binary trees

diff program output N = 10 with this 1KB output file to check your program is correct before contributing.

We are trying to show the performance of various programming language implementations - so we ask that contributed programs not only give the correct result, but also use the same algorithm to calculate that result.

Each program should

Note: this is an adaptation of a benchmark for testing GC so we are interested in the whole tree being allocated before any nodes are GC'd - which probably excludes lazy evaluation.

Note: the left subtrees are heads of the right subtrees, keeping a depth counter in the accessors to avoid duplication is cheating!

Note: the tree should have tree-nodes all the way down, replacing the bottom nodes by some other value is not acceptable; and the bottom nodes should be at depth 0.

Note: these programs are being measured with the default initial heap size - the measurements may be very different with a larger initial heap size or GC tuning.

Please don't implement your own custom memory pool or free list.


The binary-trees benchmark is a simplistic adaptation of Hans Boehm's GCBench, which in turn was adapted from a benchmark by John Ellis and Pete Kovac.

Thanks to Christophe Troestler and Einar Karttunen for help with this benchmark.

Revised BSD license

  Home   Conclusions   License   Play