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 12.2312.2399,528850  0% 0% 0% 100%
1.1C++ GNU g++ #6 13.4713.47148,652892  0% 0% 0% 100%
1.2GNU gcc #2 14.5114.5149,9241641  0% 0% 0% 100%
1.4ATS 16.8716.87132,0401060  0% 0% 0% 100%
2.0Java 6 steady state #2 24.1124.18840,456675  0% 0% 0% 100%
2.1Lisp SBCL 25.8225.82231,576612  0% 0% 0% 100%
2.3Java 6 -server #2 28.2128.35255,460603  0% 0% 0% 99%
2.5Scala #4 29.9730.09256,064536  0% 0% 0% 100%
2.5Clean #3 30.5630.56131,592539  0% 0% 1% 100%
2.5Pascal Free Pascal 31.1731.1765,616769  0% 0% 0% 100%
2.7Haskell GHC 33.1433.15169,016512  0% 0% 0% 100%
2.7Haskell GHC #2 33.2433.24193,604544  0% 6% 0% 100%
2.9GNU gcc 35.0235.0266,168706  0% 0% 0% 100%
3.3Erlang HiPE 40.4540.35187,868441  0% 100% 1% 1%
3.3C++ GNU g++ #2 40.7540.7599,396553  1% 6% 0% 100%
3.6Ada 2005 GNAT 44.2144.2199,580955  0% 0% 0% 100%
3.7OCaml #2 44.9544.9578,852784  0% 0% 0% 100%
3.9Fortran Intel 47.9047.9065,940826  0% 1% 0% 100%
4.1Erlang HiPE #2 49.8349.85179,000499  8% 0% 81% 11%
5.4GNU gcc #5 65.7465.73285,936963  0% 0% 0% 100%
5.4GNU gcc #4 66.2966.29139,208672  0% 0% 0% 100%
5.9Scheme PLT #2 71.7671.76248,520503  0% 0% 0% 100%
6.4C# Mono #2 77.8477.84235,664650  0% 0% 0% 100%
7.8JavaScript V8 95.6695.67188,024467  0% 0% 0% 100%
11Java 6 -Xint #2 128.55128.64257,612603  0% 0% 0% 100%
12Smalltalk VisualWorks 146.17146.17121,992722  0% 0% 0% 100%
12Lua LuaJIT #2 147.96147.95877,760446  0% 0% 0% 100%
13Lua LuaJIT 153.21153.21953,404443  0% 0% 0% 100%
14F# Mono 172.41172.41237,252587  0% 0% 0% 100%
14Mozart/Oz 175.91175.90398,700479  0% 1% 0% 100%
16Go 6g 8g 194.72194.71250,044527  0% 0% 0% 100%
22Ruby 1.9 265.07265.06299,960412  0% 0% 0% 100%
28Ruby JRuby 5 min5 min1,184,816412  0% 0% 0% 100%
42Lua 8 min8 min815,620443  0% 0% 0% 100%
43Lua #2 8 min8 min812,176446  0% 0% 0% 100%
58Python 3 #6 11 min11 min695,308626  0% 0% 0% 100%
67Python CPython #6 13 min13 min674,580626  0% 0% 0% 100%
87Ruby MRI 17 min17 min457,796412  0% 0% 0% 100%
106Perl #2 21 min21 min643,488541  0% 0% 0% 100%
122PHP #2 24 min24 min1,220,416493  0% 0% 0% 100%
133PHP 27 min27 min1,199,8281089  0% 0% 0% 100%
186Python CPython #2 37 min37 min221,588365  1% 1% 1% 100%
JavaScript TraceMonkey Failed467
interesting alternative programs
0.9Clean 10.6510.6566,572538
 Lisaac #2 Failed  691
1.8Go 6g 8g #2 22.0822.08111,304719
2.7Haskell GHC #3 33.2833.28193,604544
14Lua LuaJIT #3 176.89176.88547,776470
31Lua #3 376.37376.35551,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