How big is the measured performance difference?

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

 binary-trees benchmark N=20

This table shows 5 measurements - CPU Time, Elapsed Time, Memory, Code and ~ CPU Load.

Compare how much Memory the binary-trees programs used - sort Memory KB. Compare how much Code the programs used - sort Code B

Column × shows how many times more each program used compared to the program that used least.

    sort sort sort sort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ~ CPU Load
1.0GNU gcc #7 13.715.10100,688850  50% 34% 85% 81%
1.2C++ GNU g++ #6 18.866.32173,332892  60% 74% 74% 71%
3.0Java 6 steady state #2 28.7615.40855,996675  52% 46% 41% 48%
3.0OCaml #2 54.0915.4578,852784  81% 100% 79% 90%
3.3ATS 16.8416.84132,0401060  0% 0% 100% 0%
3.8Java 6 -server #2 29.6319.18289,920603  24% 75% 27% 28%
3.8Erlang HiPE #2 55.3319.28179,688499  68% 68% 61% 90%
4.2Scala #4 34.1121.21292,472536  64% 29% 43% 24%
4.5GNU gcc #5 83.6723.01258,892963  88% 86% 98% 90%
5.1Lisp SBCL 25.8325.83231,576612  2% 0% 0% 100%
6.0Clean #3 30.7330.73131,592539  0% 0% 0% 100%
6.1Pascal Free Pascal 31.2931.2865,620769  0% 100% 0% 0%
6.3GNU gcc #2 123.1432.1758,0481641  93% 91% 100% 98%
6.5Haskell GHC 49.5333.05194,792512  17% 58% 57% 17%
6.6Haskell GHC #2 64.2633.48221,464544  48% 40% 55% 42%
6.9GNU gcc 34.9534.9566,168706  0% 0% 0% 100%
7.9Erlang HiPE 40.3740.29188,380441  96% 4% 0% 0%
8.0C++ GNU g++ #2 40.7140.7199,396553  0% 0% 0% 100%
8.6Ada 2005 GNAT 44.0944.0899,580955  0% 0% 100% 0%
9.3C# Mono #2 83.4347.30235,596650  26% 25% 100% 25%
9.4Fortran Intel 48.0648.0665,936826  0% 0% 0% 100%
13GNU gcc #4 65.9265.92139,208672  100% 0% 0% 0%
14Scheme PLT #2 71.7471.74253,944503  100% 0% 0% 0%
19JavaScript V8 95.2095.21188,024467  0% 0% 100% 0%
23Java 6 -Xint #2 132.08119.49289,060603  7% 91% 7% 6%
27Smalltalk VisualWorks 138.23138.22121,988722  0% 1% 0% 100%
29Lua LuaJIT #2 149.33149.34877,752446  0% 100% 0% 0%
30Lua LuaJIT 153.21153.21953,400443  0% 100% 0% 2%
34F# Mono 173.57173.57237,064587  0% 0% 100% 0%
35Mozart/Oz 178.37178.37448,028479  0% 0% 0% 100%
38Go 6g 8g 194.92194.91249,884527  0% 100% 0% 0%
38Python 3 #6 12 min195.42695,172626  92% 91% 92% 97%
53Ruby 1.9 267.96267.89299,944412  0% 0% 100% 0%
54Ruby JRuby 6 min273.451,406,184412  26% 32% 17% 64%
58Python CPython #6 17 min296.77674,488626  85% 85% 86% 97%
98PHP 27 min8 min1,199,7561089  77% 78% 96% 76%
103Lua 8 min8 min815,616443  47% 53% 0% 0%
103Lua #2 8 min8 min812,172446  1% 9% 92% 0%
210Ruby MRI 17 min17 min457,788412  1% 100% 1% 1%
253Perl #2 21 min21 min643,488541  0% 0% 100% 0%
290PHP #2 24 min24 min1,220,408493  0% 0% 0% 100%
445Python CPython #2 37 min37 min221,588365  26% 75% 2% 1%
JavaScript TraceMonkey Failed467
interesting alternative programs
2.1Clean 10.6310.6366,572538
 Lisaac #2 Failed  691
4.4Go 6g 8g #2 22.2022.20111,304719
6.5Haskell GHC #3 62.7032.99223,512544
35Lua LuaJIT #3 177.52177.51547,768470
75Lua #3 382.57382.56551,244470
missing programs
Lisaac 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.

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