From: David Monniaux <David.Monniaux@ens.fr>
To: Liste CAML <caml-list@inria.fr>
Cc: Antoine Mine <Antoine.Mine@ens.fr>
Subject: OCaml performance (was: Re: [Caml-list] DFT in OCaml vs. C)
Date: Thu, 27 Mar 2003 17:06:44 +0100 (MET) [thread overview]
Message-ID: <Pine.GSO.4.03.10303271612340.60-100000@basilic.ens.fr> (raw)
In-Reply-To: <20030327153247.A5015@pauillac.inria.fr>
> The "Pentium 4 SSE2" column is an experimental code generator for the
> Pentium 4 that uses SSE2 instructions and registers for floating-point
> computations. (Before you ask: no, it's not publically available,
In this case, to get meaningful comparison results, you should use
gcc -march=pentium4 -msse2 or icc -march=pentium4
> and it delivers about 2/3 of the performances of C, even on the Pentium.
Let me tell you about our experience here. We are developing a large
program consisting of
- a large part of Caml code handling complex data structures
- a smaller C library handling certain numerical matrix computations that
are triggered by the Caml code
- some C (+ assembler) libraries dealing with system-dependent issues.
I profiled the code using OProfile (http://oprofile.sourceforge.net), for
expenses in clock cycles and cache faults. Earlier attempts were made with
gprof.
It turned out that we spent a significant amount of time in:
- The Caml polymorphic compare function (15% time + some cache faults)
Part of the problem seems to lie with the fact that the same function is
called when comparing strings, int64's and other types, thus the
processor has to do lots of tests and jumps just to get at the correct
comparison function.
Wouldn't it be reasonable to define String.compare and Int64.compare to
call monomorphic functions?
- The garbage collector (15% time + lots of cache faults)
There's little we can do about it. Changing the size of the minor heap,
adjusting it to optimize the use of L2 cache seems to gain 2.30% of the
total running time.
Curiously, using the compactor seems to slow things slightly.
Would it be possible to optimize the GC cache-wise? For instance, have
it ask the processor to "prefetch" data.
- 17% in a particular matrix function written in C. There's little we can
do except trying to optimize it carefully and compiling it with the best
C compiler around.
- The rest of the time is spent within the Caml code.
Now this was a bit surprising to us, because we thought we spent far more
time in the numerical computations.
Now back to the original question about DFTs. In your real-life
application, will DFT computations make a major part of the clock cycles
spent by the program?
David Monniaux http://www.di.ens.fr/~monniaux
Laboratoire d'informatique de l'École Normale Supérieure,
Paris, France
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
next prev parent reply other threads:[~2003-03-27 16:06 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-27 7:33 [Caml-list] DFT in OCaml vs. C Issac Trotts
2003-03-27 10:58 ` Fabrice Le Fessant
2003-03-27 19:40 ` Issac Trotts
2003-03-27 14:21 ` Markus Mottl
2003-03-27 20:47 ` Issac Trotts
2003-03-27 14:32 ` Xavier Leroy
2003-03-27 14:55 ` Falk Hueffner
2003-03-27 16:06 ` David Monniaux [this message]
2003-03-27 21:27 ` OCaml performance (was: Re: [Caml-list] DFT in OCaml vs. C) Issac Trotts
2003-03-27 20:54 ` [Caml-list] DFT in OCaml vs. C Issac Trotts
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.GSO.4.03.10303271612340.60-100000@basilic.ens.fr \
--to=david.monniaux@ens.fr \
--cc=Antoine.Mine@ens.fr \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox