caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Ray tracer language comparison
@ 2005-10-03 23:18 Jon Harrop
  2005-10-04 13:49 ` [Caml-list] " Thomas Fischbacher
  2005-10-09  5:26 ` Thomas Fischbacher
  0 siblings, 2 replies; 14+ messages in thread
From: Jon Harrop @ 2005-10-03 23:18 UTC (permalink / raw)
  To: caml-list


I've updated my language comparison with four implementations in Scheme and 
one in Lisp:

  http://www.ffconsultancy.com/free/ray_tracer/languages.html

In short, Stalin's run-time performance is excellent (36% faster than 
ocamlopt) but its compile times are poor (2,000x slower than ocamlopt!) and 
SBCL-compiled Lisp is 6x slower than ocamlopt. Both Scheme and Lisp are >2x 
as verbose as OCaml.

Juho Snellman posted an interesting Lisp variant that used a macro to factor 
out unboxing, greatly reducing the stress on the GC and improving Lisp's 
performance to that of OCaml. Applying the same optimisation to the OCaml 
implementations makes them much faster again but I have yet to factor this 
out into a camlp4 macro.

This raises two interesting questions:

1. Can a camlp4 macro be written to factor out this unboxing transformation:

  let v = center -| orig in
  let b = dot v dir in
  let disc = b *. b -. dot v v +. radius *. radius in

where "+|" denotes vector addition and "*|" denotes scalar*vector 
multiplication. Transformed to:

  let vx = center.x -. orig.x in
  let vy = center.y -. orig.y in
  let vz = center.z -. orig.z in
  let b = vx *. dir.x +. vy *. dir.y +. vz *. dir.z in
  let vv = vx *. vx +. vy *. vy +. vz *. vz in
  let disc = b *. b -. vv +. radius *. radius in

So the intermediate vectors are not allocated and collected.

2. Manually inlining the code gives a huge performance improvement but using 
-inline does not appear to give this improvement. I assume ocamlopt can 
inline this but will not remove the boxing and subsequent unboxing. Is that 
right?

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


^ permalink raw reply	[flat|nested] 14+ messages in thread
* Re: [Caml-list] Ray tracer language comparison
@ 2005-10-09 14:38 yoann padioleau
  2005-10-09 16:00 ` Chris Campbell
  0 siblings, 1 reply; 14+ messages in thread
From: yoann padioleau @ 2005-10-09 14:38 UTC (permalink / raw)
  To: Thomas Fischbacher, Yaron Minsky; +Cc: caml-list

> 
> > It seems like on the whole a more fitting riposte might have been to
> > provide a version of the SBCL implementation that was 8x faster than
> > Jon's, rather than to provide a crippled version of Jon's that was 8x
> > slower.  But to each his own, I suppose....
> 
> What? You call that elegant use of higher order functions "crippled"? 
> What a Blasphemy. I am really, truly outraged.

But on what side are you ? 

Looking at your signature you seems like a big fan of functionnal programming 
but you are sending opposite signals in your post. 
It is not clear to me what is your point. What do you want to demonstrate ? 


> 
> ...on the other hand... 
> 
> [wicked thinking]
> [most evil sniggering]
> [pictures of the great evil genius playing the organ]
> [more of all the above]
> [ *clickediclick* ]
> 
> Bring that man to be, he shalt be served as well!
> 
> I just extended my analysis by another implementation in yet another 
> language. This time, it's "Steel Bank Common Lisp". As this is a Lisp as 
> well, I will be concerned primarily with comparing it against SBCL, but it 
> may also be nice to compare it with OCaml, or Objective Caml.
> 
> There it is:
> 
> http://www.cip.physik.uni-muenchen.de/~tf/raytracer/#sbcl
> 
> -- 
> regards,               tf@cip.physik.uni-muenchen.de              (o_
>  Thomas Fischbacher -  http://www.cip.physik.uni-muenchen.de/~tf  //\
> (lambda (n) ((lambda (p q r) (p p q r)) (lambda (g x y)           V_/_
> (if (= x 0) y (g g (- x 1) (* x y)))) n 1))                  (Debian GNU)
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
> 
> 


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2005-10-09 18:07 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-10-03 23:18 Ray tracer language comparison Jon Harrop
2005-10-04 13:49 ` [Caml-list] " Thomas Fischbacher
2005-10-09  5:26 ` Thomas Fischbacher
2005-10-09 11:24   ` Yaron Minsky
2005-10-09 13:59     ` Thomas Fischbacher
2005-10-09 17:37       ` Florian Weimer
2005-10-09 18:07         ` Thomas Fischbacher
2005-10-09 14:53   ` Vincenzo Ciancia
2005-10-09 10:19     ` [Caml-list] " Gerd Stolpmann
2005-10-09 11:26       ` sejourne_kevin
2005-10-09 14:58   ` [Caml-list] " Jon Harrop
2005-10-09 17:25     ` Thomas Fischbacher
2005-10-09 14:38 yoann padioleau
2005-10-09 16:00 ` Chris Campbell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).