Go to Google Groups Home    comp.lang.scheme
Ray tracer in Stalin

Jon Harrop <use...@jdh30.plus.com>

I've just done a little benchmarking of the ray tracer written in Scheme and
compiled using Stalin. Here are the results. On x86 (900MHz Athlon T-bird):

$ g++ -O3 -march=athlon-tbird -ffast-math ray.cpp -o ray
$ time ./ray 6 160 >image.pgm
real    0m2.152s

$ mlton ray.sml
$ time ./ray 6 160 >image.pgm
real    0m2.435s

$ ocamlopt -inline 100 -ffast-math ray.ml -o ray
$ time ./ray 6 160 >image.pgm
real    0m3.255s

$ stalin -d0 -d1 -d5 -d6 -On -q -d -architecture IA32-align-double
-no-clone-size-limit -split-even-if-no-widening -copt -O2 -copt
-fomit-frame-pointer -copt -malign-double ray
$ time ./ray 6 160 >image.pgm
real    0m3.712s

On AMD64 (1.8GHz Athlon64):

$ g++ -O3 -march=athlon-tbird -ffast-math ray.cpp -o ray
$ time ./ray 6 160 >image.pgm
real    0m0.987s

$ mlton ray.sml
$ time ./ray 6 160 >image.pgm
real    0m1.056s

$ ocamlopt -inline 100 -ffast-math ray.ml -o ray
$ time ./ray 6 160 >image.pgm
real    0m1.037s

$ stalin -d0 -d1 -d5 -d6 -On -q -d -architecture IA32-align-double
-no-clone-size-limit -split-even-if-no-widening -copt -O2 -copt
-fomit-frame-pointer -copt -malign-double ray
$ time ./ray 6 160 >image.pgm
real    0m1.773s

I hadn't expected a simple Lisp or Scheme implementation to be able to
compete in terms of performance but only 70% slower on 32-bit AMD64 when
C++ and OCaml are fully 64-bit is very impressive, IMHO.

--
Dr Jon D Harrop, Flying Frog Consultancy
http://www.ffconsultancy.com