Caml Light performance tests?

Mark Hayden (hayden@cs.cornell.edu)
Tue, 12 Mar 1996 00:29:41 -0500

Date: Tue, 12 Mar 1996 00:29:41 -0500
Message-Id: <199603120529.AAA02769@verdandi.cs.cornell.edu>
From: Mark Hayden <hayden@cs.cornell.edu>
To: caml-list@pauillac.inria.fr
Subject: Caml Light performance tests?

Hi,
I'm fine-tuning a program that compiles with both Caml Light and Caml
Special Light. In doing so, I've made lots of guesses about the relative
performance of different coding styles. I'm thinking of putting together
some performance tests to eliminate my guesswork. As you'll see, I'm not
interested in real application benchmarks, but just the relative costs of,
for instance, iterating over a vector with "do_vect" verses an explicit
"for" loop. I have several questions for the Caml Light community:

* Has anyone else already made such tests? (If so, what
were the results and is the code available?)

* What are the issues for the cases below?

* Are there suggestions for other interesting tests?

thanks,
Mark

options:
Caml Light, CSL-byte, CSL-native
safe & unsafe
architecture (I'm interesting in sparc 20s)

1.
let f = fun x -> ... in
...

do_vect f v

VS

do_vect (fun x -> ... ) v ;

VS

for i = 0 to pred (vect_length v) do
...
done

2.

do_list (fun x -> ... ) l

VS

let rec loop = function
| [] -> ()
| hd::tl -> (
... ;
loop tl
)
in loop l

3.

let g = f x in
for i = 1 to 1000 do
g y
done

VS

for i = 1 to 1000 do
f x y
done

4.

let f () =
if ... then None
else Some ...
in

for i = 1 to 1000 do
match f () with
| None -> ()
| Some x -> ...
done

VS

let f g =
if ... then g ...
in

for i = 1 to 1000 do
f (fun x -> ...)
done

4. cost of calling identity function

5. cost of an additional argument to a function

6. overhead of calling an external C function

7. cost of a let binding (is there any?)