Python Interpreters Benchmarks
x64 ArchLinux : Intel® i5-7200U®

 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.0Nuitka #7 2.300.6916,612741  78% 83% 93% 82%
1.1Nuitka 2.440.7516,676706  81% 77% 93% 81%
1.1Pyston 2.030.7636,896743  63% 65% 84% 62%
1.2PyPy 2 1.740.8289,292743  47% 75% 48% 46%
1.2Nuitka #6 2.780.8317,388743  84% 80% 92% 83%
1.3Python development version #7 2.960.8915,880741  85% 84% 80% 89%
1.3Python 3 #7 2.980.9015,752741  91% 83% 82% 82%
1.4Python 3 3.200.9615,760706  83% 83% 84% 89%
1.4Python development version 3.160.9715,616706  85% 75% 89% 82%
1.5PyPy 3 #7 1.951.02137,688741  78% 36% 40% 41%
1.5Python 2 3.751.0416,568743  91% 90% 90% 96%
1.5Python development version #6 3.551.0516,748743  90% 85% 86% 83%
1.5Python 3 #6 3.601.0616,576743  92% 86% 86% 83%
1.6PyPy 3 #6 2.281.1289,220743  46% 39% 41% 85%
1.7PyPy 3 2.261.1889,808706  41% 79% 36% 40%
1.7Numba 3.871.1922,116702  95% 79% 76% 81%
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