Version franaise
Home About Download Resources Contact us

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
The Implicit Accumulator: a design pattern using optional arguments
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-06-29 (01:17)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] The Implicit Accumulator: a design pattern using optional arguments
On Thursday 28 June 2007 17:01:05 you wrote:
> the continuation-based approach can execute not using the GC
> at all - neither major nor minor. Sure, the OCaml GC behaves so
> nicely that it does not make a difference in terms of run-time for
> this particular small example


> (1) is this the same if the minor heap is more complicated, as in a real
> application and 

Converting to CPS typically slows programs down IME.

> (2) shouldn't there be huge potential for optimization in the second case
> then? 


> In particular, concerning point (2), when comparing run times
> with the following bit of C code, I find that both OCaml
> variants are slower than the C variant by more than a factor
> of 3:

You are benchmarking "mod" and bounds checking.

> >>According to your usually-screwed-up metrics...
> >
> > Time taken?
> We are talking about your ray-tracer here.


> For those who do not know yet, the fundamental problem with that study
> of yours is that you kept on setting the *criteria* what to consider as
> a permissible solution only after seeing the result, and doing so in
> such a way that the outcome is the one you desired, i.e. to create the
> impression OCaml were the best system around. This is not proper
> scientific behaviour.

My choice of the intermediate implementations is subjective. The shortest and 
faster are a free for all. Feel free to post a faster Lisp implementation.

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
The OCaml Journal