Version française
Home     About     Download     Resources     Contact us    
Browse thread
Camlmake.
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: OCaml is fast!
> or is my benchmark wrong? The speed is incredable, I have a 333 Mhz PII, and
> Ocaml make 50 miljon round trips in the loop per second, that is 6 cycles
> per loop, and in each loop one function call + add + store is done.
> 
> Or does the compiler optimize away a lot of my code? The code can be found
> in the end of the file.

The functions nooo_init and nooo_move are small enough to be inlined,
so the loops in test_nooo_speed and test_nooo_speed_2 perform no
function calls.  To measure the cost of function calls, you can
disable inlining with the "-inline 0" compiler flag.

Methods are never inlined at point of call, though, because it would
require global program analysis.

One last suggestion: if you use Unix.gettimeofday instead of Unix.time,
you'll get sub-second resolution for the timings.

- Xavier Leroy