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.0Cython 1.870.5662,244735  82% 93% 82% 82%
1.0Cython 1.850.5661,984735  82% 93% 82% 80%
1.0Cython 1.870.5661,260735  82% 82% 95% 82%
1.1Pyston 1.920.62169,100743  74% 93% 73% 71%
1.2Pyston 1.950.65169,224743  69% 67% 94% 70%
1.3Pyston 1.960.72172,728743  68% 88% 71% 67%
1.4Nuitka #7 2.410.7769,168741  82% 87% 83% 81%
1.4Nuitka #7 2.400.7866,324741  86% 92% 85% 83%
1.6Nuitka 2.640.8767,076706  81% 89% 87% 78%
1.6Nuitka #7 2.390.8969,092741  83% 88% 82% 94%
1.6PyPy 2 2.090.91324,636743  65% 51% 54% 71%
1.6Nuitka #6 2.900.9174,740743  81% 80% 83% 95%
1.7PyPy 2 2.130.9687,280743  61% 51% 54% 63%
1.7Nuitka 2.730.9770,008706  71% 88% 69% 73%
1.8Nuitka #6 2.940.9973,432743  85% 84% 88% 92%
1.8Nuitka #6 2.940.9970,216743  77% 76% 87% 81%
1.8PyPy 2 2.191.01322,228743  78% 70% 61% 58%
1.8Nuitka 2.641.0168,676706  83% 87% 80% 80%
1.9Python development version #7 3.831.0560,736741  95% 90% 90% 90%
1.9Python 3 3.701.0667,320706  88% 95% 88% 89%
1.9Python 3 #7 3.531.0759,940741  84% 83% 91% 82%
2.0Python 3 3.761.1159,900706  95% 83% 84% 83%
2.0Python development version #7 3.911.1157,176741  97% 85% 85% 85%
2.0Python 2 3.771.1454,152743  82% 81% 82% 90%
2.1Python 2 3.831.1556,040743  83% 82% 81% 93%
2.1Numba 3.931.1673,772702  85% 91% 83% 83%
2.1Python 3 #6 4.101.1662,824743  96% 89% 88% 87%
2.1Python 2 3.811.1660,644743  79% 87% 84% 82%
2.1Python 3 #6 4.051.1664,604743  87% 87% 94% 87%
2.1Python 3 3.681.1864,940706  86% 83% 82% 86%
2.2Python development version #7 3.921.2062,372741  88% 83% 78% 79%
2.2Python 3 #7 3.521.2264,232741  80% 77% 79% 87%
2.2Numba 3.991.2364,276702  78% 78% 79% 90%
2.2Python development version 4.111.2361,960706  83% 80% 81% 94%
2.2Python 3 #6 4.131.2366,360743  85% 83% 94% 84%
2.2Numba 4.001.2463,976702  77% 78% 91% 79%
2.2Python 3 #7 3.571.2566,472741  78% 82% 90% 83%
2.2Python development version #6 4.511.2557,916743  95% 89% 89% 88%
2.2Python development version #6 4.461.2667,100743  87% 89% 93% 89%
2.3PyPy 3 2.641.2789,940706  46% 55% 50% 79%
2.3Python development version 4.051.2859,068706  87% 83% 84% 81%
2.3PyPy 3 #7 2.671.2890,956741  46% 49% 83% 45%
2.3Python development version #6 4.591.2969,196743  93% 86% 92% 87%
2.3PyPy 3 #6 2.681.2992,112743  42% 73% 45% 58%
2.3PyPy 3 #7 2.681.2989,676741  45% 54% 47% 81%
2.3PyPy 3 2.671.3090,260706  50% 41% 77% 47%
2.3Python development version 4.091.3162,208706  86% 79% 81% 81%
2.4PyPy 3 2.701.3189,700706  72% 46% 44% 54%
2.4PyPy 3 #6 2.821.3393,272743  42% 52% 47% 83%
2.5PyPy 3 #6 2.761.3793,024743  50% 63% 55% 82%
2.7PyPy 3 #7 2.701.5289,732741  50% 50% 60% 49%
missing benchmark programs
Jython No program
IronPython No program
Shedskin No program
MicroPython No program
Grumpy 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