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 RAA11421; Wed, 7 Jul 2004 17:49:26 +0200 (MET DST) 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 RAA10707; Wed, 7 Jul 2004 17:49:25 +0200 (MET DST) Received: from fw.m12.ru (49_161.otts.ru [195.162.49.161] (may be forged)) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i67FnMEV015480; Wed, 7 Jul 2004 17:49:23 +0200 Received: from jah.m12.ru ([192.168.1.1]) by fw.m12.ru with esmtp (Exim 3.36 #1 (Debian)) id 1BiEeY-0002le-00; Wed, 07 Jul 2004 22:48:10 +0700 Received: from codedj by jah.m12.ru with local (Exim 3.36 #1 (Debian)) id 1BiEeY-0001e2-00; Wed, 07 Jul 2004 22:48:10 +0700 To: Xavier Leroy Cc: Evgeny Chukreev , "Basile Starynkevitch [local]" , caml-list@inria.fr Subject: Re: [Caml-list] Does Caml have slow arithmetics ? References: <20040707091308.GA26172@bourg.inria.fr> <20040707145803.GB27498@yquem.inria.fr> From: Evgeny Chukreev Date: Wed, 07 Jul 2004 22:48:10 +0700 In-Reply-To: <20040707145803.GB27498@yquem.inria.fr> (Xavier Leroy's message of "Wed, 7 Jul 2004 16:58:03 +0200") Message-ID: User-Agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Miltered: at nez-perce with ID 40EC1B82.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 arithmetics:01 2004:99 ocamlopt's:01 inlining:01 caml:01 wrote:03 let:04 let:04 pair:04 pair:04 slow:05 functions:05 output:05 jul:06 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Wed, 7 Jul 2004 16:58:03 +0200 Xavier Leroy wrote: > On the other hand, reducing inefficiencies already present in the > source code isn't a priority. In your "f" function, you asked for the > construction of a pair, and you get that pair construction in > ocamlopt's output. If you didn't want the pair to be constructed, why > did you write "f" this way? This example was reduced version of: let g a b = a*b, a+b let f a b = let x, y = g a b in ... with inlining we got: let f a b = let x, y = a*b, a+b in ... so pair will be constructed... There is no way to return >1 values at once without contstructing memory block and then decomposing it. Yes, I could do this as in C: let g a b r1 r2 = r1 := a*b; r2 := a+b let f a b = let x = ref 0 in let y = ref 0 in g a b x y; ... but it's not best choice. Many of my functions return >1 values, so it's not empty talking. -- ... WBR, Evgeny ... ------------------- 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