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.8313.84149,588850  1% 2% 1% 100%
1.2Java 6 steady state #2 16.1316.15913,088675  0% 0% 0% 100%
1.2ATS 16.4316.43198,4321060  0% 0% 0% 100%
1.2C++ GNU g++ #6 16.5216.51296,208892  0% 1% 0% 100%
1.3GNU gcc #2 17.4517.4599,2841641  0% 0% 0% 100%
1.3Scala #4 17.7517.77577,388536  4% 0% 0% 100%
1.3Java 6 -server #2 18.5118.55565,112603  0% 0% 0% 100%
1.4Haskell GHC #2 19.6519.65329,080544  0% 0% 0% 100%
1.4Haskell GHC 19.7719.77360,816512  0% 0% 0% 100%
2.4GNU gcc 33.1833.18131,816706  0% 0% 0% 100%
2.6C++ GNU g++ #2 35.5035.49197,836553  0% 0% 0% 100%
2.7Ada 2005 GNAT 37.6137.61198,160955  0% 0% 0% 100%
2.7Lisp SBCL 38.0438.04407,052612  0% 0% 0% 100%
3.2Erlang HiPE 43.7343.63373,264441  1% 100% 0% 0%
3.2Clean #3 44.7144.72262,708539  0% 0% 0% 100%
3.4Fortran Intel 46.6246.62131,536826  0% 0% 0% 100%
3.7OCaml #2 51.6551.65157,668784  0% 0% 0% 100%
4.4GNU gcc #4 61.4861.48289,980672  0% 0% 0% 100%
4.5Erlang HiPE #2 62.4762.48355,520499  0% 100% 0% 0%
4.7Pascal Free Pascal 65.3265.31131,292769  0% 0% 0% 100%
4.7GNU gcc #5 65.5065.50514,260963  0% 0% 0% 100%
5.8Scheme PLT #2 80.5780.56452,372503  0% 0% 0% 100%
7.8C# Mono #2 107.84107.84454,504650  0% 0% 3% 100%
8.5JavaScript V8 117.66117.66386,944467  0% 0% 0% 100%
9.5Java 6 -Xint #2 131.42131.49547,096603  0% 0% 0% 100%
13F# Mono 184.43184.45390,136587  0% 0% 0% 100%
16Go 6g 8g 225.48225.47296,052527  0% 0% 0% 100%
18Smalltalk VisualWorks 255.48255.46197,720722  0% 0% 0% 100%
22Ruby JRuby 299.45299.701,981,416412  0% 0% 0% 100%
48Lua 10 min10 min1,688,960443  0% 0% 1% 100%
48Lua #2 11 min11 min1,683,288446  0% 1% 0% 100%
65Python CPython #6 15 min15 min1,349,936626  0% 0% 0% 100%
91Ruby MRI 20 min20 min781,212412  0% 0% 0% 100%
96PHP #2 22 min22 min2,311,976493  1% 0% 0% 100%
108Perl #2 24 min24 min1,091,276541  0% 0% 0% 100%
140PHP 26 min32 min2,266,1361089  25% 25% 26% 100%
214Python CPython #2 49 min49 min445,616365  0% 0% 0% 100%
JavaScript TraceMonkey Failed467
interesting alternative programs
0.8Clean 11.0311.03132,168538
1.4Haskell GHC #3 19.6619.67329,080544
1.7Go 6g 8g #2 23.1023.10222,396719
32Lua #3 436.36436.33997,004470

 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