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 benchmark program that used least Time or the program that used least Memory.

 binary-trees benchmark N=16

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 benchmark programs used - sort Code B

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

    sort sort sort sort
  ×   Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
1.0GNU gcc #3 0.853,900758  
1.9GNU gcc #2 1.604,512743  
3.4Java 6 -Xms64m #2 2.8939,436603  
3.8SML MLton #2 3.2045,760530  
3.9Haskell GHC 3.359,152512  
4.2Erlang HiPE 3.5818,096441  
4.4Lisp SBCL #2 3.7236,324553  
4.5GNU gcc 3.794,536706  
4.6Pascal Free Pascal 3.924,224769  
4.7Clean #3 3.9816,868539  
4.8Intel 4.064,576706  
4.8Eiffel SmartEiffel #2 4.1111,652630  
5.1Digital Mars #2 4.344,724705  
5.3C++ GNU g++ #2 4.476,996541  
5.6Pascal Free Pascal #2 4.734,236629  
5.7Scala #4 4.8054,684536  
5.7OCaml 4.838,732469  
5.7C++ Intel #2 4.876,524541  
5.8BASIC FreeBASIC #2 4.904,852723  
5.9Fortran Intel 5.034,508826  
6.1Ada 2005 GNAT 5.146,608955  
6.6Mercury 5.5928,944910  
7.0Scala 5.9258,656529  
7.0 #2 5.9320,708603  
8.1Java 6 -server #2 6.8926,808603  
8.2Java GNU gcj #2 6.9524,032603  
8.7Java 6 -client #2 7.3626,136603  
8.8Nice 7.4523,984485  
8.9CAL 7.5827,308736  
9.6Smalltalk VisualWorks 8.1126,852722  
9.7C# Mono 8.2514,584610  
12Scheme PLT #2 10.1629,992503  
14F# Mono 11.5922,656587  
14Oberon-2 OO2C 11.9717,244755  
18Forth GNU GForth 15.664,888564  
25Java 6 -Xint #2 21.4624,364603  
27Mozart/Oz 23.1027,252479  
31Digital Mars 26.2617,596511  
40Prolog YAP 34.2820,252719  
47Python Psyco #3 39.4516,704431  
47Fortran G95 39.6910,736826  
56Groovy #2 47.3651,108506  
59Smalltalk Squeak 49.7631,384722  
64Ruby 1.9 #2 54.4117,864409  
65Groovy 55.3253,632519  
78Forth bigForth 65.988,916433  
84Python IronPython #3 71.4184,772418  
93Pike 78.4716,568520  
97Icon 82.1715,860526  
110Python CPython #3 93.4116,116418  
166Ruby JRuby #2 140.87136,048409  
177JavaScript SpiderMonkey 150.07136,832467  
203Ruby MRI #2 172.3148,756409  
204PHP #2 173.2581,648493  
208Tcl 176.0730,592540  
220JavaScript Rhino 186.9481,940467  
282Perl #2 239.3647,936541  
300Perl 254.1837,604481  
587CINT 8 min10,132698  
2,079Rebol 29 min78,484490  
6,422Io 1h 30 min109,996400  
Prolog SWI Failed790
Smalltalk GNU Failed729
"interesting alternative" programs
 Python IronPython Failed  377
 C++ Intel #3 Failed  814
0.3C++ GNU g++ #3 0.260.002,192814
0.7C++ GNU g++ 0.600.001,860778
1.2C++ Intel 0.980.002,072778
1.2Intel #3 1.050.003,940758
1.3Clean 1.080.008,748538
1.7OCaml #3 1.440.008,844502
1.9Intel #2 1.580.004,556743
2.3OCaml #4 1.980.0011,772504
2.6Lisaac #2 2.230.00345,352691
3.6Haskell GHC #4 3.070.006,192510
3.8Scheme Ikarus 3.240.0029,612592
11Scheme PLT 9.600.0018,268482
18Python Psyco 14.990.0016,692389
23Scheme Chicken 19.300.0032,768493
44Lua LuaJIT #3 37.450.0040,852470
66Lua #3 55.690.0034,464470
79Python CPython 66.960.0016,172377
missing benchmark programs
Lisaac No program
Lua No program
Lua LuaJIT No program
Scheme Chicken No program
Scheme Ikarus No program
SML SML/NJ No program
Zonnon Mono 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

  Home   Flawed   Fastest   License   Help