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.1Cython 1.910.6660,388735  73% 85% 73% 71%
1.1Cython 1.880.6860,940735  72% 75% 87% 69%
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.4PyPy 2 1.700.84351,120743  56% 48% 49% 68%
1.4PyPy 2 1.720.8487,340743  50% 69% 48% 50%
1.4Cython 2.000.8660,872735  83% 83% 76% 81%
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.4PyPy 2 1.770.9087,240743  75% 49% 48% 60%
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 3.300.9661,252706  86% 94% 88% 89%
1.5Python development version #7 3.060.9661,908741  89% 88% 91% 95%
1.5Nuitka #6 2.960.9675,392743  85% 84% 84% 91%
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 2.681.0068,828706  82% 84% 84% 92%
1.6Python 3 #7 3.141.0358,832741  82% 79% 80% 89%
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 2.151.1289,520706  50% 42% 38% 72%
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 development version #7 3.071.1760,992741  92% 93% 92% 88%
1.9PyPy 3 #6 2.241.1789,216743  41% 43% 38% 77%
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 #6 2.281.2188,988743  43% 39% 42% 74%
2.0Numba 3.991.2364,276702  78% 78% 79% 90%
2.0Numba 4.001.2463,976702  77% 78% 91% 79%
2.0PyPy 3 2.321.2689,088706  79% 59% 53% 57%
2.1PyPy 3 #7 2.331.2889,836741  78% 47% 52% 51%
2.1PyPy 3 2.301.2988,288706  74% 56% 44% 56%
2.1PyPy 3 #7 2.361.2989,640741  73% 67% 58% 68%
2.2Python development version #6 3.661.3667,628743  88% 93% 89% 90%
2.2PyPy 3 #7 2.391.3690,252741  67% 61% 82% 68%
2.3PyPy 3 #6 2.601.4188,332743  53% 49% 61% 76%
missing benchmark programs
Jython No program
IronPython 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