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 RAA09818; Wed, 7 Jul 2004 17:08:50 +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 RAA09639; Wed, 7 Jul 2004 17:08:49 +0200 (MET DST) Received: from yquem.inria.fr (yquem.inria.fr [128.93.8.37]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i67Ew3EV009389; Wed, 7 Jul 2004 16:58:03 +0200 Received: by yquem.inria.fr (Postfix, from userid 18180) id A57E0BBD8; Wed, 7 Jul 2004 16:58:03 +0200 (CEST) Date: Wed, 7 Jul 2004 16:58:03 +0200 From: Xavier Leroy To: Evgeny Chukreev Cc: "Basile Starynkevitch [local]" , caml-list@inria.fr Subject: Re: [Caml-list] Does Caml have slow arithmetics ? Message-ID: <20040707145803.GB27498@yquem.inria.fr> References: <20040707091308.GA26172@bourg.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Miltered: at nez-perce with ID 40EC0F7B.001 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 ocaml's:01 tagging:01 programmer's:01 ocamlopt's:01 compiler:01 caml:01 trivial:01 compiling:03 let:04 let:04 pair:04 pair:04 slow:05 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > Do developers plan to add new kinds of optimization in a near future? > > Trivial example: > > let f a b = > let a, b = a, b in > a + b > > let g a b = > a + b The main purpose of OCaml's compiler optimizations is to avoid introducing inefficiencies while compiling. In other terms, the main objective is to generate good machine code from good source code. In this respect, optimizations of redundant tagging operations is crucial, since this aspect of execution is not apparent in the source code. Other examples include register allocation and instruction selection, which are not under the programmer's control 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? - Xavier Leroy ------------------- 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