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.7667,912741  87% 83% 81% 79%
1.2Nuitka #7 2.470.7669,088741  82% 84% 81% 86%
1.2Nuitka #7 2.540.7764,280741  82% 84% 83% 88%
1.3PyPy 2 1.820.83356,408743  51% 52% 59% 70%
1.3PyPy 2 1.820.83365,712743  47% 55% 73% 56%
1.4Nuitka #6 3.000.8668,340743  86% 90% 91% 91%
1.4Nuitka #6 2.940.8671,908743  89% 93% 85% 84%
1.4Nuitka #6 2.930.8772,132743  83% 95% 86% 83%
1.4Nuitka 2.670.8764,204706  85% 79% 78% 75%
1.5Nuitka 2.750.9571,188706  71% 72% 85% 71%
1.5Nuitka 2.770.9566,420706  74% 73% 86% 69%
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 3 3.280.9664,672706  90% 86% 90% 87%
1.6Python 3 #7 3.050.9863,236741  84% 79% 84% 82%
1.6PyPy 3 #7 1.991.00120,176741  42% 41% 85% 41%
1.6Python 3 #7 3.141.0358,832741  82% 79% 80% 89%
1.7PyPy 3 #7 2.011.05135,940741  44% 41% 79% 41%
1.7Python development version #7 3.781.0861,480741  90% 90% 89% 91%
1.7Python development version #7 3.761.0862,704741  86% 88% 92% 88%
1.7Python development version #7 3.771.0858,920741  87% 88% 87% 94%
1.8PyPy 2 1.841.1086,728743  42% 46% 49% 66%
1.8PyPy 3 #7 2.041.11132,552741  77% 38% 42% 40%
1.8Python development version 3.991.1559,040706  90% 90% 90% 87%
1.9Numba 3.931.1673,772702  85% 91% 83% 83%
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 3 #6 3.741.1768,820743  97% 81% 90% 82%
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 2.281.2187,308706  46% 47% 69% 39%
2.0Numba 3.991.2364,276702  78% 78% 79% 90%
2.0PyPy 3 2.261.2387,056706  78% 39% 44% 36%
2.0Python development version 4.011.2361,116706  89% 89% 84% 92%
2.0Numba 4.001.2463,976702  77% 78% 91% 79%
2.0PyPy 3 #6 2.421.2490,300743  80% 44% 44% 38%
2.0Python development version #6 4.361.2465,296743  89% 89% 94% 87%
2.0PyPy 3 2.361.2587,828706  38% 78% 40% 49%
2.0Python development version #6 4.331.2562,976743  87% 96% 85% 88%
2.0PyPy 3 #6 2.421.2590,236743  46% 77% 40% 44%
2.0Python development version #6 4.431.2667,692743  88% 90% 87% 92%
2.2Python development version 4.091.3560,976706  89% 90% 90% 85%
2.3PyPy 3 #6 2.411.4389,652743  51% 43% 62% 41%
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