
jon:
On Friday 22 June 2007 19:54:16 Philip Armstrong wrote:
On Fri, Jun 22, 2007 at 10:11:27PM +0400, Bulat Ziganshin wrote:
btw, *their* measurement said that ocaml is 7% faster :)
Indeed. The gcc-4.0 compilied binary runs at about 15s IIRC, but it's still much better than 7% faster than the ocaml binary.
What architecture, platform, compiler versions and compile lines are you using?
On my 2x 2.2GHz Athlon64 running x64 Debian I now get:
GHC 6.6.1: 26.5s ghc -funbox-strict-fields -O3 ray.hs -o ray
Don't use -O3 , its *worse* than -O2, and somewhere between -Onot and -O iirc, ghc -O2 -funbox-strict-fields -fvia-C -optc-O2 -optc-ffast-math -fexcess-precision Are usually fairly good.
OCaml 3.10.0: 14.158s ocamlopt -inline 1000 ray.ml -o ray g++ 4.1.3: 8.056s g++ -O3 -ffast-math ray.cpp -o ray
Also, the benchmarks and results that I cited before are more up to date than the ones you're using. In particular, you might be interested in these faster versions:
http://www.ffconsultancy.com/languages/ray_tracer/code/5/ray.ml http://www.ffconsultancy.com/languages/ray_tracer/code/5/ray.cpp
For "./ray 6 512", I get:
OCaml: 3.140s ocamlopt -inline 1000 ray.ml -o ray C++: 2.970s g++ -O3 -ffast-math ray.cpp -o ray
-- Dr Jon D Harrop, Flying Frog Consultancy Ltd. The OCaml Journal http://www.ffconsultancy.com/products/ocaml_journal/?e