From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id BAA26230; Sat, 24 Jan 2004 01:32:05 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id BAA26192 for ; Sat, 24 Jan 2004 01:32:04 +0100 (MET) Received: from smtp2.pp.htv.fi (smtp2.pp.htv.fi [213.243.153.14]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i0O0W3v02078 for ; Sat, 24 Jan 2004 01:32:04 +0100 (MET) Received: from posti.pp.htv.fi (posti.pp.htv.fi [212.90.64.50]) by smtp2.pp.htv.fi (Postfix) with ESMTP id 65AFC297383; Sat, 24 Jan 2004 02:32:03 +0200 (EET) Received: from oro (aka.pp.htv.fi [213.243.183.115]) by posti.pp.htv.fi (8.11.1 (Revision 1.5+JAGae91741+JAGae92668) /8.11.1) with ESMTP id i0O0W2b11599; Sat, 24 Jan 2004 02:32:02 +0200 (EET) Received: from naked by oro with local (Exim 3.36 #1 (Debian)) id 1AkBiS-0004XY-00; Sat, 24 Jan 2004 02:32:00 +0200 To: Jan Kybic Cc: caml-list@inria.fr Subject: Re: [Caml-list] Q: Efficient operations on complex numbers References: From: Nuutti Kotivuori Date: Sat, 24 Jan 2004 02:31:59 +0200 In-Reply-To: (Jan Kybic's message of "23 Jan 2004 11:24:32 +0100") Message-ID: <87broukwzk.fsf@naked.iki.fi> User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Portable Code, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 0.98:01 fishy:01 inlining:01 inlines:01 inlining:01 -inline:01 -inline:01 floats:01 compiler:01 compiler:01 ocaml:01 ocaml:01 caml:01 module:03 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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