Version française
Home     About     Download     Resources     Contact us    
Browse thread
Announce: glome-0.2 (ocaml-based raytracer)
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Announce: glome-0.2 (ocaml-based raytracer)
On Wednesday 17 January 2007 23:01, you wrote:
> I haven't benchmarked, but I think you should get better results than
> if you were using virtual method dispatch in an inner loop.

I had already implemented that recursion trick but I accidentally sent my 
response to Jim alone without spamming the list. Here's my latest source:

  http://www.ffconsultancy.com/temp/glome.tar.bz2

I'm compiling with:

ocamlopt -inline 100 -unsafe -noassert -I +lablGL lablgl.cmxa 
lablglut.cmxa -dtypes vec.ml clr.ml material.ml types.ml sphere.ml 
triangle.ml group.ml kdtree.ml solid.ml camera.ml light.ml scene.ml trace.ml 
glome.ml -o glome

Balls 14, Jim's then mine:

kdtree build time: 0.772883
with gc: 0.786881
total  :2.393636

kdtree build time: 0.645902
with gc: 0.689895
total  :2.331646

Tetra, Jim's then mine:

kdtree build time: 6.934946
with gc: 6.952944
total  :0.429935

kdtree build time: 6.31004
with gc: 6.360033
total  :0.396939

So my implementation is ~8% faster. That isn't significant, but the reduction 
in source code of 25% is!

The code will be smaller and faster with records for vectors rather than 
arrays. More importantly, we can rid of that hideous -unsafe. I'll do it ASAP 
but I'm really busy writing more books on FPLs. ;-)

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists