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.440.7670,668741  80% 84% 84% 91%
1.2Nuitka #7 2.460.7670,648741  83% 95% 83% 83%
1.2Nuitka #7 2.530.7669,376741  83% 88% 84% 91%
1.3PyPy 2 1.740.82318,608743  60% 44% 51% 70%
1.3PyPy 2 1.730.8387,832743  55% 47% 52% 68%
1.4PyPy 2 1.770.8687,696743  51% 75% 46% 49%
1.4Nuitka #6 2.910.8672,340743  87% 89% 96% 86%
1.4Nuitka 2.630.8663,880706  76% 84% 86% 77%
1.4Nuitka 2.680.8763,508706  80% 79% 76% 83%
1.5Python 3 3.270.9662,884706  88% 88% 85% 94%
1.5Python 3 3.250.9661,568706  90% 88% 86% 94%
1.5Python 3 #7 3.020.9660,852741  82% 88% 81% 83%
1.5Python development version #7 3.120.9664,676741  91% 91% 88% 88%
1.5Python development version 3.300.9661,252706  86% 94% 88% 89%
1.5Python development version #7 3.060.9661,908741  89% 88% 91% 95%
1.5Python 3 3.280.9664,672706  90% 86% 90% 87%
1.5Nuitka #6 2.960.9675,392743  85% 84% 84% 91%
1.6Python 3 #7 3.050.9863,236741  84% 79% 84% 82%
1.6Nuitka 2.681.0068,828706  82% 84% 84% 92%
1.6Python 3 #7 3.141.0358,832741  82% 79% 80% 89%
1.7PyPy 3 #7 1.991.06135,232741  43% 76% 48% 41%
1.7Nuitka #6 2.941.0668,416743  78% 87% 79% 86%
1.7Python development version 3.361.0661,920706  83% 88% 82% 83%
1.8PyPy 3 #7 2.071.11131,472741  43% 39% 82% 49%
1.8PyPy 3 #7 2.031.13127,200741  42% 43% 34% 81%
1.8Python development version 3.431.1463,932706  82% 86% 79% 88%
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 3 #6 3.591.1766,680743  87% 85% 84% 80%
1.9Python development version #7 3.071.1760,992741  92% 93% 92% 88%
1.9PyPy 3 #6 2.361.1794,880743  47% 47% 77% 45%
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%
2.0PyPy 3 #6 2.431.2394,128743  46% 42% 81% 43%
2.0Numba 3.991.2364,276702  78% 78% 79% 90%
2.0Numba 4.001.2463,976702  77% 78% 91% 79%
2.0PyPy 3 2.271.2592,408706  46% 36% 75% 42%
2.0PyPy 3 2.281.2593,840706  44% 37% 80% 38%
2.0PyPy 3 2.281.2693,988706  45% 75% 43% 39%
2.2Python development version #6 3.661.3667,628743  88% 93% 89% 90%
2.3PyPy 3 #6 2.421.4596,228743  53% 37% 55% 59%
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