The version that can do this is here.
And the sources are here.
Included in the above are versions of Cubes written in Java, and Scala, for comparison with CAL. The Java version is written in a typical OO style, and the Scala version is written in a typical FP style (e.g. no Scala "var"s are used).
Various timing are taken between the generation of each frame of the cubes animation. The basic sequence is:
Running the benchmark is done as follows:
java [options] -jar cubes3.jar [language]
Where language is either:
cal
java
scala
And the options are:
-Dhse.graphics.frametime=n To set the time in milliseconds between each frame,
-Dhse.graphics.printtime=n To set the time in seconds of each benchmark run.
-Dhse.graphics.display=0 To disable the graphical output.
A typical run might be:
java -Dhse.graphics.ticktime=10 -Dhse.graphics.printticks=5 -Dhse.graphics.display=0 -jar cubes3.jar java
The benchmark will repeat until it is terminated with Ctrl-C.
The first number should equal the sum of the second two. In practice a 1 ns difference often occurs which is probably due to a nanosecond rollover occurring somewhere in the benchmark processing code. An error message is displayed if the difference is not 0 or 1 ns,
The following results were obtained on a 2 GHz Athlon 64 3200+
Taking the fastest time for each language the results above appear to show that the Java version
is fastest, with the Scala version being about 1.85 times slower, and the CAL version being
about 19.85 times slower.
M:\jars>java -Dhse.graphics.frametime=10 -Dhse.graphics.printtime=5 -Dhse.graphics.display=0 -jar cubes3.jar java
The frame time in ms is = 10.000000
Print frame count = 500
Displaying = false
[10.000927:9.137308:0.863618]
[10.001239:9.583913:0.417325]
[10.001420:9.592373:0.409047]
[10.001434:9.554762:0.446671]
[10.001483:9.557219:0.444264]
[10.001385:9.578321:0.423063]
[10.001437:9.582132:0.419304]
[10.001406:9.567107:0.434298]
[10.003747:9.547868:0.455879]
[10.001095:9.550305:0.450790]
M:\jars>java -Dhse.graphics.frametime=10 -Dhse.graphics.printtime=5 -Dhse.graphics.display=0 -jar cubes3.jar scala
The frame time in ms is = 10.000000
Print frame count = 500
Displaying = false
[9.999247:8.575566:1.423680]
[9.999545:9.221754:0.777791]
[9.999490:9.188447:0.811043]
[9.999407:9.212009:0.787397]
[9.999544:9.221398:0.778145]
[9.999474:9.246745:0.752728]
[9.999428:9.219771:0.779656]
[9.999496:9.214618:0.784878]
[9.999471:9.255190:0.744280]
[10.001442:9.255183:0.746258]
M:\jars>java -Dhse.graphics.frametime=10 -Dhse.graphics.printtime=5 -Dhse.graphics.display=0 -jar cubes3.jar cal
The frame time in ms is = 10.000000
Print frame count = 500
Displaying = false
[11.083005:0.000000:11.083005]
[10.002741:2.071878:7.930862]
[10.004958:2.151614:7.853343]
[10.002760:2.055139:7.947620]
[10.002419:1.917638:8.084781]
[10.000455:2.040118:7.960337]
[10.005376:1.968004:8.037371]
[10.001393:2.027359:7.974033]
[9.999504:2.106548:7.892955]
[10.005863:2.017812:7.988050]
M:\jars>