Kawa in Languages shootout

Updated: Now with numbers for chameneos-redux (chameneosredux.scm) and meteor-contest (meteor.scm) contributed by Jamison Hope.

The Computer Language Shootout Benchmarks Game has implementations in a number of different languages of a number of different programs.

We now have Kawa-Scheme versions of all the current programs. You can find them in the testsuite directory of the Kawa source code.

You can look at the raw measurements.csv or data.csv, but the table below (generated with a Scheme script) summarizes the results. The numbers are relative cpu-time, as divided by the fastest Java version. (For now I'm focusing on single-CPU performance. I'll look into multi-threaded solutions later, after I get a quad-core laptop to test with.) Each cell may have multiple numbers, indicating multiple programs for a given language and problem. In the Java column, at least one of the results will be 1.00, as expected.

binarytrees1.001.05 1.46 1.0427.361.103.72
chameneosredux1.00 3.92 1.850.99 4.0846.430.951.96
fannkuchredux1.00 1.431.23 0.943.5461.661.381.34
fasta1.001.33 0.675.32 4.3271.36 58.501.725.46
knucleotide1.06 1.002.16 1.467.93 7.2210.54 8.9311.11 1.6211.18 1.71
mandelbrot1.00 1.01 1.06 1.091.19 1.16 1.102.28186.491.051.05
meteor2.16 1.0013.2541.80 26.301.252.11
pidigits1.000.30 0.831.280.630.63
regexdna1.29 1.00 1.001.51 1.27 1.001.634.20 2.80 1.821.051.04
revcomp1.000.81 23.729.52 5.557.151.43 1.171.44 1.17
spectralnorm1.00 1.051.02 1.03137.54 174.761.058.98
threadring8.07 1.005.8416.02 21.030.960.96

All of the languages first compile to .class files, which are then executed by the JVM. The Kawa column is Kawa with the default calling convention, while the Kawa/FTC column is the same Kawa programs compiled using the --full-tailcalls flag. The latter is a bit slower, especially for programs that do many function calls, but not as bad I had feared. (The --full-tailcalls mechanism has not been optimized/profiled as much as I'd like, though it's generally going to be slower.) The Kawa programs do use type annotations, and are generally written with performance in mind.

As expected, Scala and Kawa come closest to Java performance. Note that the Scala and Kawa versions of pidigits are actually faster than the Java version, but that is because this test depends heavily on bignum (infinite-precision integer) calculations, and the standard Java BigInteger class is not as efficient as it could be. (Alternative Java version of pidigits use the gmp library.) Clojure is bit slower, while JRuby is substantially slower.

Version notes

The tests were run on a Lenovo ThinkPad T400, with Intel Core2 Duo CPU P8600 (2.40GHz stepping 06), and 3GB of main memory. The operating system was Fedora GNU/Linux 13, updated.

The Java VM used was OpenJDK version 1.6.0_21. The JRuby version was 1.5.3. Clojure was version 1.2.0. Scala was version 2.8.0.final. Kawa was version 1.11.