English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Benchmark] NBody
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-02-25 (13:01)
From: Christophe TROESTLER <debian00@t...>
Subject: NBody (one more question)

I'd like to come back to the nbody mini-benchmark with one more
question (I apologize if I bother some people but I think there are
competent people here who can clarify the situation for me).

When I compile the C code with -O0 (with gcc -o nbody.gcc -Wall
--fast-math nbody.c -lm), I get a time of 1.513s which is comparable
to OCaml (1.607s).  But as soon as I turn on -O options (as with gcc
-o nbody.gcc -Wall -O1 --fast-math nbody.c -lm), the running time
drops down to 0.871s (0.58%).  Can somebody tell me what is the
optimization that has such an effect and whether it could be applied
to OCaml ?  (I am not saying or asking it to be done -- it is not up
to me to decide -- I just want to understand -- and I am not versed
enough in assembly to do it myself unfortunately :( ).