binary-trees benchmark N=14

Each chart bar shows how many times more Memory, one ↓ binary-trees program used, compared to the program that used least Memory.

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.

    sortsort sort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0Python 3 3.511.0153,164706  92% 86% 87% 88%
1.0Python 3 #7 3.310.9953,660741  87% 80% 83% 93%
1.0Python development version 3.911.7554,252706  94% 90% 92% 94%
1.0Python development version 3.501.1754,252706  91% 86% 90% 84%
1.0Python development version #7 3.160.9354,360741  89% 85% 94% 85%
1.0Python 3 3.501.0355,800706  88% 83% 87% 89%
1.1Python development version #7 3.140.9355,884741  89% 86% 84% 91%
1.1Python 3 3.591.0456,520706  87% 89% 92% 84%
1.1Python 3 #6 3.921.1256,816743  92% 86% 87% 91%
1.1Python 3 #7 3.200.9657,316741  89% 84% 81% 88%
1.1Python development version #7 3.170.9357,616741  89% 87% 88% 88%
1.1Python development version 3.561.1557,800706  94% 90% 86% 96%
1.1Python 3 #7 3.200.9658,724741  86% 91% 86% 83%
1.1Python 2 3.771.1958,912743  91% 82% 83% 88%
1.1Nuitka #7 2.480.8059,364741  91% 80% 80% 80%
1.1Python 2 3.821.1959,484743  81% 91% 82% 80%
1.1Nuitka #7 2.560.8059,984741  82% 80% 81% 90%
1.1Python 2 3.851.2060,452743  79% 87% 86% 80%
1.1Nuitka #7 2.590.7960,604741  91% 81% 82% 85%
1.2Nuitka 2.800.9262,312706  93% 79% 84% 76%
1.2Python 3 #6 4.011.2162,500743  97% 82% 82% 81%
1.2Python 3 #6 3.911.1262,908743  89% 89% 90% 88%
1.2Numba 4.001.2463,976702  77% 78% 91% 79%
1.2Nuitka 2.830.8664,056706  86% 80% 84% 90%
1.2Nuitka #6 3.241.5964,228743  96% 96% 92% 91%
1.2Numba 3.991.2364,276702  78% 78% 79% 90%
1.2Nuitka 2.780.8565,080706  81% 78% 88% 93%
1.2Nuitka #6 3.200.9866,084743  89% 75% 85% 89%
1.3Nuitka #6 3.261.4267,512743  94% 99% 91% 94%
1.4Numba 3.931.1673,772702  85% 91% 83% 83%
1.7PyPy 2 1.971.2088,304743  50% 50% 44% 53%
1.7PyPy 2 1.860.9188,772743  80% 47% 41% 47%
1.7PyPy 2 1.830.8789,104743  48% 45% 79% 46%
1.7PyPy 3 #6 2.501.5890,040743  52% 54% 64% 48%
1.7PyPy 3 #6 2.411.2390,080743  46% 80% 44% 35%
1.7PyPy 3 #6 2.361.1790,220743  44% 79% 47% 39%
1.7PyPy 3 2.341.2290,260706  50% 78% 37% 34%
1.7PyPy 3 2.271.1690,624706  47% 75% 42% 37%
1.7PyPy 3 2.301.2190,992706  41% 39% 44% 76%
2.6PyPy 3 #7 2.051.05137,772741  40% 42% 45% 78%
2.6PyPy 3 #7 2.041.05138,804741  42% 42% 76% 39%
2.6PyPy 3 #7 2.051.08138,904741  40% 76% 38% 44%
3.2Pyston 1.920.62169,100743  74% 93% 73% 71%
3.2Pyston 1.950.65169,224743  69% 67% 94% 70%
3.2Pyston 1.960.72172,728743  68% 88% 71% 67%
missing benchmark programs
Jython No program
IronPython No program
Cython No program
Shedskin No program
MicroPython No program
Grumpy No program
Graal No program
RustPython 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