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.0 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 2954FBC6D for ; Fri, 1 Jun 2007 18:53:17 +0200 (CEST) Received: from pih-relay05.plus.net (pih-relay05.plus.net [212.159.14.132]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l51GrG4x015951 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Fri, 1 Jun 2007 18:53:16 +0200 Received: from [80.229.56.224] (helo=beast.local) by pih-relay05.plus.net with esmtp (Exim) id 1HuANH-0001s3-01; Fri, 01 Jun 2007 17:53:15 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Comparison of OCaml and MLton for numerics Date: Fri, 1 Jun 2007 17:47:49 +0100 User-Agent: KMail/1.9.7 Cc: Alain Frisch References: <5195a210705302250u6a9e5adey4ed857480f9e5cd8@mail.gmail.com> <466033EC.3050909@janestcapital.com> <46603DFE.7020406@inria.fr> In-Reply-To: <46603DFE.7020406@inria.fr> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200706011747.49303.jon@ffconsultancy.com> X-Miltered: at concorde with ID 46604EFC.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 frisch:01 inlining:01 compiler:01 inlining:01 computed:01 abstraction:01 inlined:01 inlined:01 ocaml:01 recursive:01 stdlib:01 frog:98 wrote:01 caml-list:01 On Friday 01 June 2007 16:40:46 Alain Frisch wrote: > 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. This is an excellent example of something that can be done simply and effectively by specializing only stdlib calls. Float array operations are another place where OCaml leaves expensive checks in the inner loop unnecessarily: Array.fold_left (+.) 0. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. OCaml for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists/?e