Version française
Home     About     Download     Resources     Contact us    
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: Nuutti Kotivuori <naked+caml@n...>
Subject: Re: [Caml-list] Q: Efficient operations on complex numbers
Jan Kybic wrote:
> 3) I could improve the OCaml time to 0.98s by including the code
> from the Complex module in my source file. (Is there a way of
> achieving the same result without actually copying it?) On the other
> hand, it did not matter whether I used tuples or records to
> represent the complex numbers, whether I defined the 'add' and 'mul'
> functions locally or at the top level, and whether I asked the
> compiler to inline or not.

I am not well versed enough to answer your other questions properly,
but this made me think there might be something fishy going around.

OCaml doesn't inline functions from other compilation units right
now. So inlining would be the natural cause of getting the speed
increase.

The OCaml compiler inlines by default - and turning off that inlining
isn't all that obvious. Calling 'ocamlopt -inline 0' will not turn it
off; but it will only inline if it doesn't increase code size. If you
truly wish to turn inlining off, you need to say 'ocamlopt -inline
-1'. And in the opposite direction it's similar. There is no simple
inlining enabled rule, but you have to specify the aggressivity to
inline yourself, for example by saying 'ocamlopt -inline 100'.

But, I have no idea if these will really make a difference, or even if
I have totally missed something here. Hopefully someone who knows a
bit more about OCaml performance with floats will chime in to tell
about it.

-- Naked

-------------------
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