Version française
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
OCaml troll on Slashdot
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-03-17 (10:31)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] OCaml troll on Slashdot
On Thursday 17 March 2005 03:35, brogoff wrote:
> I just ran your counterexample and the tail recursive code was faster
> for each. I used native code compilation.

That's odd. My previous results were for a 1.2GHz Athlon t-bird, ocamlopt 
3.08. Tail recursion is also significantly slower on an 866MHz P3 (x86 
native-code) with ocamlopt 3.07:

Non-tail-recursive took: 0.873906s
Tail-recursive took: 1.005320s

Non-tail-recursive took: 4.288313s
Tail-recursive took: 0.986330s

And on an Athlon MP 2600+ with ocamlopt 3.06:

Non-tail-recursive took: 0.289890s
Tail-recursive took: 0.332338s

Non-tail-recursive took: 1.981812s
Tail-recursive took: 0.332071s

This may be a cache effect as these CPUs all have 256kb cache. Perhaps if you 
try a smaller/larger problem depending on your cache size...

Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists