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=1.2 required=5.0 tests=AWL,SPF_NEUTRAL 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 42584BC69 for ; Fri, 1 Jun 2007 18:14:38 +0200 (CEST) Received: from nz-out-0506.google.com (nz-out-0506.google.com [64.233.162.234]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l51GEaL1023984 for ; Fri, 1 Jun 2007 18:14:37 +0200 Received: by nz-out-0506.google.com with SMTP id s1so487467nze for ; Fri, 01 Jun 2007 09:14:36 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=uoa8RiasiXtPZG5qBDzZ7jaOZB1IOQ66lT6Hpyobb1U9gm1fVIvvHWIjdQR7MqWaVl7kUs4IRZpIysGjx3t/t8hFTiNWzuU6Tq+5TDMBnmfVfW0iC59twnRRcFmK99v83TVKWRpM/HzursP0konExFzXp4ce0LiAaenpg0qLEN0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HW8Uhm9onkMP5ZOV8YsxRvKw/d7fhzgStQ/XmykHzETqlNGpgFX3MHyV4RDx4boeeoOmMSy+HZA7d0jzfT0smJkBCVDhd3vd2tajIyp/3Nla9ibd6KZZy2NCEdTuB7eQ5M0TGQlCetee2sTFokN2TscXcaJJHKieaxpK2lJuwS4= Received: by 10.143.7.11 with SMTP id k11mr95862wfi.1180714476200; Fri, 01 Jun 2007 09:14:36 -0700 (PDT) Received: by 10.142.255.12 with HTTP; Fri, 1 Jun 2007 09:14:36 -0700 (PDT) Message-ID: Date: Fri, 1 Jun 2007 12:14:36 -0400 From: "Markus Mottl" To: "David MENTRE" Subject: Re: [Caml-list] Comparison of OCaml and MLton for numerics Cc: caml-list@yquem.inria.fr In-Reply-To: <3d13dcfc0706010449k53f1c364gfd4db47c7c258725@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <5195a210705302250u6a9e5adey4ed857480f9e5cd8@mail.gmail.com> <200705311008.16662.jon@ffconsultancy.com> <5195a210705310222p6aa8482fr70e7bf2b2b631b72@mail.gmail.com> <200705311127.28639.jon@ffconsultancy.com> <465F3E8C.10404@inria.fr> <1180660974.15528.126.camel@rosella.wigram> <465FAF0B.5060700@inria.fr> <891bd3390706010429g2ac722bfmc6932b15393a62b9@mail.gmail.com> <3d13dcfc0706010449k53f1c364gfd4db47c7c258725@mail.gmail.com> X-j-chkmail-Score: MSGID : 466045ED.000 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 466045ED.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; markus:01 mottl:01 markus:01 mottl:01 ocaml:01 yaron:01 minsky:01 yminsky:01 functors:01 ocaml:01 hash:01 readable:01 higher-level:01 inlining:01 compiler:01 On 6/1/07, David MENTRE wrote: > 2007/6/1, Yaron Minsky : > > In other words, > > factoring out with functors and modules is good style, but OCaml penalizes > > you for it. > > A naive and somewhat provocative question: is the performance penalty > a real issue in your production code or just a known overhead that is > easily solved by having a more powerful computer? In other words, is > the complexity price of better optimizations justified considering its > real impact in production code? Absolutely! E.g. we had to specialize hash tables for integer and string keys, because the generic implementation calls a function for each key comparison rather than generating specialized code for e.g. integer comparisons. This has a noticable impact in production systems. There are plenty of cases where I had to manually unfold function definitions like e.g.: let f = g h where h is some function. This leads to a lot of code duplication, and makes code considerably less readable (though a lot more efficient if e.g. h is applied to each character in a string). I'd surely be happy to see the addition of some (optional) higher-level code transformations to OCaml. Not just inlining, maybe some partial evaluation of the resulting code, which could also reduce code size if the compiler can prove that certain branches will not be taken. Regards, Markus -- Markus Mottl http://www.ocaml.info markus.mottl@gmail.com