Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Q: Efficient operations on complex numbers
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jan Kybic <kybic@f...>
Subject: Re: [Caml-list] Q: Efficient operations on complex numbers
Xavier Leroy:
> Yes, it does, if the .cmx files for the other compilation units are
> available.  So, I'm a bit surprised about what Jan Kybic observed.
> What I would have expected is that referring to the Complex module or
> copying it inside the source file shouldn't change the generated
> code, at least if you stay at the default inlining level.

Thank you for your reply. Yes, you are right, if I inline at
sufficiently high level (say 'ocamplopt -inline 10), then using the
Complex module is as fast as copying the code. 

As for the slowdown, it apparently depends on the compiler and/or
processor. On my system:

    Intel(R) Pentium(R) M processor 1400MHz
    Mandrake Linux release 9.1 (Bamboo) for i586
    gcc version 3.2.2 (Mandrake Linux 9.1 3.2.2-3mdk)
    The Objective Caml native-code compiler, version 3.07

I find that Ocaml program takes about 170~200% of the time of the C++
version, while on Christophe TROESTLER's machine (Intel(R) Pentium(R)
4 CPU 2.40GHz)), who kindly repeated my experiments, it was just
140%. So this is really a complex issue with many variables.

If I gain more insight into it, I will keep you posted.


Jan Kybic <>                  tel. +420 2 2435 7264
       or <>,

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: