From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=AWL,MISSING_HEADERS autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id B33CABC69 for ; Fri, 1 Jun 2007 17:40:48 +0200 (CEST) Received: from [128.93.11.101] (buzet.inria.fr [128.93.11.101]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l51Femnd013074 for ; Fri, 1 Jun 2007 17:40:48 +0200 Message-ID: <46603DFE.7020406@inria.fr> Date: Fri, 01 Jun 2007 17:40:46 +0200 From: Alain Frisch User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Comparison of OCaml and MLton for numerics References: <5195a210705302250u6a9e5adey4ed857480f9e5cd8@mail.gmail.com> <891bd3390706010429g2ac722bfmc6932b15393a62b9@mail.gmail.com> <20070601214326.e0a939a6.mle+ocaml@mega-nerd.com> <200706011258.59177.jon@ffconsultancy.com> <604682010706010718x42221e8rde56317905f5c972@mail.gmail.com> <466033EC.3050909@janestcapital.com> In-Reply-To: <466033EC.3050909@janestcapital.com> X-Enigmail-Version: 0.95.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 46603E00.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; frisch:01 frisch:01 ocaml:01 inlining:01 ocaml:01 pervasives:01 inlining:01 compiler:01 computed:01 abstraction:01 inlined:01 inlined:01 recursive:01 wrote:01 integer:01 Brian Hurt wrote: > where the function is only called from one place, or 3) where inlining > opened up signifigant other optimization opportunities. The classic > example for Ocaml here is replacing a call to Pervasives.compare with an > integer compare. Most of the rest of the time, inlining is either a > break even proposition, or often a loss. Another good situation is when inlining allows the compiler to turn a function call to an unknown location into a direct function call (or no function call at all). This happens as soon as you write "List.map (fun x -> ...)". Inlining List.map would avoid the allocation of the closure and a computed call (and then the local abstraction will also be inlined in the body of the inlined List.map because it is used only once). Currently, OCaml never inlines recursive functions. -- Alain