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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Vu Ngoc San <san.vu-ngoc@u...>
Subject: Re: [Caml-list] function definition
Thanks for the reply.

So, I have tried to do some benchmarking, and the results are surprising.

The method: a (for i=1 to ... do) loop.

I have tried first an inlined test with

ignore(binop1 Plus sin cos 1.)

(and then binop2, binop3, binop4)

Then I have defined the function

  f = binop1 Plus sin cos

and tried the loop with

  ignore(f 1.)

Here are the results
(Linux debian 2.6.17-2-686, Intel(R) Pentium(R) M processor 1300MHz)

BYTE CODE:

Inline binop1 with 100000000 iterations:58736 msec.
Inline binop2 with 100000000 iterations:59681 msec.
Inline binop3 with 100000000 iterations:67663 msec.
Inline binop4 with 100000000 iterations:68692 msec.

f (binop1) with 100000000 iterations:53514 msec.
f (binop2) with 100000000 iterations:47794 msec.
f (binop3) with 100000000 iterations:53315 msec.
f (binop4) with 100000000 iterations:59411 msec.


NATIVE CODE:

Inline binop1 with 100000000 iterations:25017 msec.
Inline binop2 with 100000000 iterations:25860 msec.
Inline binop3 with 100000000 iterations:26310 msec.
Inline binop4 with 100000000 iterations:24251 msec.

f (binop1) with 100000000 iterations:25512 msec.
f (binop2) with 100000000 iterations:25620 msec.
f (binop3) with 100000000 iterations:25554 msec.
f (binop4) with 100000000 iterations:24801 msec.


The last method (binop4) is clearly the slowest in bytcode and the 
fastest in native code !

In native code, the difference bewteen the slowest and the fastest 
reaches 8%.
This seems to me significant enough, but I don't know whether it depends 
on the system architecture or not.

Best
San