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 2.670.7666,152706  87% 85% 88% 91%
1.2Nuitka #7 2.440.7667,832741  79% 79% 83% 84%
1.2Nuitka #7 2.450.7666,080741  80% 88% 78% 79%
1.2Nuitka 2.680.7763,896706  86% 88% 95% 85%
1.3Nuitka #7 2.630.7963,496741  91% 84% 84% 78%
1.3Nuitka 2.690.8062,928706  96% 85% 85% 81%
1.3PyPy 2 1.820.83356,408743  51% 52% 59% 70%
1.3PyPy 2 1.820.83365,712743  47% 55% 73% 56%
1.4Nuitka #6 2.960.8673,552743  93% 85% 85% 85%
1.4Nuitka #6 3.010.8673,312743  89% 85% 86% 92%
1.4Nuitka #6 3.000.8772,724743  91% 90% 85% 86%
1.5Python development version #7 3.140.9355,884741  89% 86% 84% 91%
1.5Python development version #7 3.170.9357,616741  89% 87% 88% 88%
1.5Python development version #7 3.160.9354,360741  89% 85% 94% 85%
1.5Python 3 3.250.9661,568706  90% 88% 86% 94%
1.5Python 3 3.270.9662,884706  88% 88% 85% 94%
1.5Python 3 #7 3.020.9660,852741  82% 88% 81% 83%
1.5Python 3 3.280.9664,672706  90% 86% 90% 87%
1.6Python 3 #7 3.050.9863,236741  84% 79% 84% 82%
1.6PyPy 3 #7 1.991.00120,176741  42% 41% 85% 41%
1.6Python 3 #7 3.141.0358,832741  82% 79% 80% 89%
1.7PyPy 3 #7 2.011.05135,940741  44% 41% 79% 41%
1.8PyPy 2 1.841.1086,728743  42% 46% 49% 66%
1.8PyPy 3 #7 2.041.11132,552741  77% 38% 42% 40%
1.9Python development version 3.561.1557,800706  94% 90% 86% 96%
1.9Numba 3.931.1673,772702  85% 91% 83% 83%
1.9Python 3 #6 3.671.1767,688743  84% 80% 81% 89%
1.9Python 3 #6 3.591.1766,680743  87% 85% 84% 80%
1.9Python development version 3.501.1754,252706  91% 86% 90% 84%
1.9Python 3 #6 3.741.1768,820743  97% 81% 90% 82%
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%
2.0PyPy 3 2.281.2187,308706  46% 47% 69% 39%
2.0Numba 3.991.2364,276702  78% 78% 79% 90%
2.0PyPy 3 2.261.2387,056706  78% 39% 44% 36%
2.0Numba 4.001.2463,976702  77% 78% 91% 79%
2.0PyPy 3 #6 2.421.2490,300743  80% 44% 44% 38%
2.0PyPy 3 2.361.2587,828706  38% 78% 40% 49%
2.0PyPy 3 #6 2.421.2590,236743  46% 77% 40% 44%
2.3PyPy 3 #6 2.411.4389,652743  51% 43% 62% 41%
2.8Python development version 3.911.7554,252706  94% 90% 92% 94%
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