Browse thread
Ray tracer language comparison
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Thomas Fischbacher <Thomas.Fischbacher@P...> |
| Subject: | Re: [Caml-list] Ray tracer language comparison |
On Sun, 9 Oct 2005, Jon Harrop wrote: > On Sunday 09 October 2005 06:26, you wrote: > > http://www.cip.physik.uni-muenchen.de/~tf/raytracer/ > > I reformatted your code with tuareg indentation and 80-char columns to conform > with the other implementations for fair comparison, The longest line in your original code has 79 columns. So does the longest line in my code. I do not use any indentation and formatting techniques which are not present in your original code as well. > corrected the bug in a > call to printf and removed the superfluous parentheses. Yes, I was notified of this as well and corrected it in the source. Concerning teh extra parens: I like them. Let's just consider this artisitc freedom, okay? > Your code is then 1 > line shorter and 8x slower than the previous implementation on my site. What do you mean, "previous implementation"? You provide data for OCaml, and I suggested you should include Objective Caml into the comparison as well. > I then rewrote it to be both shorter and faster. Let us see: > Printf.printf "P5\n%d %d\n255\n" n n;; > for y = n - 1 downto 0 do > for x = 0 to n - 1 do > let g = ref 0. in > for dx = 0 to ss - 1 do Ah. You eliminated the main function. Nice move. I suppose one could easily do this for the other implementations as well. As some people out there seem to wonder what this is all about: I maintain the following claim. - While Jon does not clearly state this on his web page, his main criterion for a valid submission is that it must be impossible to improve by making it both shorter and faster. - The problem with this methodology is that it does not satisfy even the most fundamental principle one would like to see in a proper comparison: If we take a product X, and a product Y, which in fact just again is X, but let us pretend for now and threat them as if they were different, then it must not be possible to make a submission for X and a submission for Y that both are valid under all the criteria applied, which lead to the conclusion that X is considerably better than Y. Okay, Jon, you just managed to produce an Objective Caml implementation which shows that I am completely wrong, and indeed, Objective Caml is even much more succinct than OCaml, while being only about 50% slower than OCaml. Why don't you include that important result on your web page? -- 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)