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

 binary-trees benchmark N=14

Each chart bar shows how many times more Code, one ↓ binary-trees program used, compared to the program that used least Code.

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.

    sortsortsort 
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0Python 3 1.190.26100,836706  61% 58% 58% 62% 58% 85% 50% 54%
1.0Python development version 1.050.212,296706  62% 57% 60% 62% 62% 55% 86% 65%
1.0Nuitka 1.240.2994,936706  52% 50% 89% 52% 52% 57% 53% 48%
1.0PyPy 3 2.941.2688,732706  69% 29% 24% 23% 28% 31% 28% 26%
1.0Numba 5 min63.59154,632734  73% 70% 76% 94% 76% 74% 69% 75%
1.0Python 3 #7 1.030.223,584741  81% 62% 55% 57% 64% 57% 62% 57%
1.0PyPy 3 #7 2.280.90128,080741  63% 24% 24% 26% 27% 27% 36% 37%
1.0Nuitka #7 1.060.222,304741  70% 62% 59% 59% 59% 82% 59% 55%
1.0Pyston #7 0.750.16?741  61% 81% 62% 50% 65% 59% 62% 61%
1.0Python development version #7 0.880.18?741  65% 61% 63% 53% 55% 85% 59% 63%
1.1PyPy 2 2.271.0491,028743  32% 67% 25% 28% 24% 28% 22% 24%
1.1PyPy 3 #6 3.071.0688,640743  34% 37% 65% 34% 34% 29% 31% 32%
1.1Nuitka #6 1.390.2796,932743  59% 61% 65% 81% 62% 63% 63% 63%
1.1Python 2 2.020.4716,340743  54% 57% 56% 54% 64% 57% 63% 54%
1.1Pyston #6 1.090.2245,372743  64% 57% 59% 81% 60% 59% 71% 65%
1.1Pyston 1.050.3182,980743  55% 52% 66% 43% 43% 41% 38% 37%
1.1Python 3 #6 1.360.27105,876743  88% 64% 57% 62% 59% 65% 59% 63%
1.1Python development version #6 1.180.23111,996743  61% 55% 95% 61% 60% 65% 57% 61%
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