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.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 #7 3.220.9660,196741  85% 88% 91% 86%
1.5Python 3 #7 3.280.9665,628741  89% 89% 84% 89%
1.6PyPy 2 1.810.9789,528743  82% 64% 72% 86%
1.6PyPy 2 1.930.9789,768743  76% 85% 72% 74%
1.6PyPy 2 1.861.0189,440743  87% 73% 79% 61%
1.7Python 3 #7 3.351.0666,428741  84% 85% 78% 81%
1.7PyPy 3 #7 2.061.07139,660741  76% 41% 38% 49%
1.7PyPy 3 #7 2.031.08138,012741  37% 78% 43% 41%
1.7PyPy 3 #7 2.021.08138,856741  39% 78% 50% 33%
1.8Python 3 3.481.1060,476706  80% 83% 80% 87%
1.8Python 3 3.551.1464,960706  77% 80% 76% 88%
1.8Python 3 3.571.1566,220706  78% 81% 77% 89%
1.9Python development version 3.561.1557,800706  94% 90% 86% 96%
1.9Numba 3.931.1673,772702  85% 91% 83% 83%
1.9PyPy 3 #6 2.361.1690,912743  61% 53% 64% 48%
1.9Python development version 3.501.1754,252706  91% 86% 90% 84%
1.9Python 3 #6 3.841.1868,676743  87% 88% 84% 80%
1.9PyPy 3 #6 2.351.1891,420743  38% 47% 77% 45%
1.9Python 2 3.821.1959,484743  81% 91% 82% 80%
1.9PyPy 3 2.261.1989,392706  46% 45% 40% 79%
1.9Python 2 3.771.1958,912743  91% 82% 83% 88%
1.9PyPy 3 #6 2.351.2090,456743  46% 47% 53% 78%
1.9Python 2 3.851.2060,452743  79% 87% 86% 80%
1.9PyPy 3 2.341.2189,820706  78% 40% 41% 43%
2.0Numba 3.991.2364,276702  78% 78% 79% 90%
2.0Numba 4.001.2463,976702  77% 78% 91% 79%
2.0Python 3 #6 3.921.2470,460743  95% 83% 83% 79%
2.0Python 3 #6 3.931.2472,528743  77% 85% 77% 87%
2.1PyPy 3 2.401.2990,188706  79% 58% 47% 51%
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