Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] OCaml speed
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Christophe Raffalli <Christophe.Raffalli@u...>
Subject: Re: [Caml-list] OCaml speed
Rolf Wester a écrit :
> 
> Hi,
> 
> I used the array access example from http://www.bagley.org/~doug/shootout/
> to compare c/c++ speed against ocaml. The sources I used are attached below.
> Unfortunately I could not confirm the given cpu times which are 0.11 sec for
> gcc and 0.13 for ocamlopt. My results on a Compaq Alpha True64 are
> 0.05 for cxx, 0.1 for g++ and 0.29 for ocamlopt. Does anybody have an idea
> what could be the reason for this inconsistency? Did I do anything wrong?
> 

Your code mainly does integer operations and array accesses.

The main difference between C and Ocaml are the reserved bit in integer used by
ocaml for the GC.
Then the generated assembly code are really different and it is possible that
this diffrence cost nothing (almost) on a pentium and a lot on a Alpha True64.

May be Xavier Leroy could look at the assembly code to tell if I am right ?

You could also try with float arrays which should make less difference for your
code ?

-- 
Christophe Raffalli
Université de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tél: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr