|
|
Of course, the compiler is still incomplete, but it turns out to be far enough along to try a first performance benchmark (Takeuchi function):
import java.lang.System;
public class Tak {
operation tak(x:Number, y: Number, z:Number):Number;
}
operation Tak.tak(x, y, z) {
return if (y >= x)
then z
else tak(tak(x-1, y, z),
tak(y-1, z, x),
tak(z-1, x, y));
}
var tak = new Tak();
System.out.println("tak(24,16,8)={tak.tak(24, 16, 8)}");
$ time java -cp ".;dist/JavaFX.jar" TakMod
tak(24,16,8)=9.0
real 0m1.333s
user 0m0.010s
sys 0m0.020s
Here's the interpreter:
$ time bin/javafx.sh TakMod.fx compile thread: Thread[main,5,main] compile 0.04 tak(24,16,8)=9.0 init: 69.48 real 1m10.422s user 0m0.190s sys 0m0.130sSpeed improvement for this particular example is a pretty awesome 54x.