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.0Pyston 1.920.62169,100743  74% 93% 73% 71%
1.0Pyston 1.950.65169,224743  69% 67% 94% 70%
1.2Pyston 1.960.72172,728743  68% 88% 71% 67%
1.2Nuitka #7 2.490.7664,448741  88% 92% 81% 86%
1.2Nuitka #7 2.500.7669,384741  87% 82% 84% 91%
1.2Nuitka #7 2.460.7667,564741  85% 82% 88% 84%
1.3PyPy 2 1.780.79319,260743  52% 71% 66% 51%
1.3PyPy 2 1.790.79316,980743  54% 70% 55% 57%
1.3PyPy 2 1.760.80317,208743  50% 49% 70% 61%
1.4Nuitka 2.700.8764,672706  85% 83% 84% 79%
1.4Nuitka 2.700.8764,916706  80% 78% 80% 87%
1.5Nuitka 2.760.9568,032706  74% 72% 72% 89%
1.5Python 3 3.250.9661,568706  90% 88% 86% 94%
1.5Python 3 3.270.9662,884706  88% 88% 85% 94%
1.5Python development version #7 3.120.9664,676741  91% 91% 88% 88%
1.5Python 3 #7 3.020.9660,852741  82% 88% 81% 83%
1.5Python development version #7 3.060.9661,908741  89% 88% 91% 95%
1.5Python development version 3.300.9661,252706  86% 94% 88% 89%
1.5Python 3 3.280.9664,672706  90% 86% 90% 87%
1.6Python 3 #7 3.050.9863,236741  84% 79% 84% 82%
1.6Nuitka #6 2.960.9871,540743  87% 79% 77% 77%
1.6Python 3 #7 3.141.0358,832741  82% 79% 80% 89%
1.7Nuitka #6 3.061.0374,452743  76% 74% 74% 89%
1.7Nuitka #6 3.021.0469,788743  74% 85% 74% 75%
1.7Python development version 3.361.0661,920706  83% 88% 82% 83%
1.7PyPy 3 #7 1.971.08132,356741  50% 39% 40% 85%
1.8PyPy 3 #7 2.081.12129,356741  70% 53% 65% 50%
1.8Python development version 3.431.1463,932706  82% 86% 79% 88%
1.8PyPy 3 #7 2.051.14126,792741  77% 63% 45% 46%
1.9Numba 3.931.1673,772702  85% 91% 83% 83%
1.9Python development version #6 3.601.1667,068743  92% 86% 91% 94%
1.9Python 3 #6 3.671.1767,688743  84% 80% 81% 89%
1.9Python development version #7 3.071.1760,992741  92% 93% 92% 88%
1.9Python 3 #6 3.591.1766,680743  87% 85% 84% 80%
1.9Python 3 #6 3.741.1768,820743  97% 81% 90% 82%
1.9Python development version #6 3.571.1865,056743  88% 86% 83% 83%
1.9Python 2 3.821.1959,484743  81% 91% 82% 80%
1.9Python 2 3.771.1958,912743  91% 82% 83% 88%
1.9Python 2 3.851.2060,452743  79% 87% 86% 80%
1.9PyPy 3 2.331.2086,088706  79% 47% 40% 38%
2.0PyPy 3 #6 2.401.2189,632743  45% 83% 45% 40%
2.0PyPy 3 2.301.2287,092706  80% 39% 36% 44%
2.0PyPy 3 #6 2.391.2287,624743  43% 44% 40% 77%
2.0Numba 3.991.2364,276702  78% 78% 79% 90%
2.0PyPy 3 2.291.2387,816706  75% 40% 40% 41%
2.0Numba 4.001.2463,976702  77% 78% 91% 79%
2.0PyPy 3 #6 2.391.2690,440743  46% 45% 45% 82%
2.2Python development version #6 3.661.3667,628743  88% 93% 89% 90%
missing benchmark programs
Jython No program
IronPython No program
Cython No program
Shedskin No program
MicroPython No program
Grumpy No program
Graal 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