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=none 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 EE796BC6F for ; Fri, 1 Jun 2007 10:09:33 +0200 (CEST) Received: from ipmail03.adl2.internode.on.net (ipmail03.adl2.internode.on.net [203.16.214.135]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5189VLD010797 for ; Fri, 1 Jun 2007 10:09:33 +0200 X-IronPort-AV: E=Sophos;i="4.16,371,1175437800"; d="scan'208";a="97605202" Received: from ppp9-14.lns1.syd7.internode.on.net (HELO [192.168.1.201]) ([59.167.9.14]) by ipmail03.adl2.internode.on.net with ESMTP; 01 Jun 2007 17:39:29 +0930 Subject: Re: [Caml-list] Comparison of OCaml and MLton for numerics From: skaller To: Alain Frisch Cc: Jon Harrop , caml-list@yquem.inria.fr In-Reply-To: <465FAF0B.5060700@inria.fr> 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> Content-Type: text/plain Date: Fri, 01 Jun 2007 18:09:27 +1000 Message-Id: <1180685367.3417.9.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 465FD43B.003 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; ocaml:01 0200,:01 frisch:01 ocaml:01 syntax:01 inlining:01 inlining:01 iter:01 abstraction:01 modular:01 functors:01 polymorphism:01 sml:01 doctor:98 compilers:01 On Fri, 2007-06-01 at 07:30 +0200, Alain Frisch wrote: > skaller wrote: > > So what I believe Jon and Xavier mean here is that the > > Ocaml compilers compile code down to stuff which is easily > > predicted in terms of the input syntax. no magic like > > invariant code motion: What You See is What You Get. > > I generally agree that automatic optimizations should not change > too much the behavior of programs unless they are very easy to > understand and predict; indeed we don't want to rely on subtle > properties of the code and see the performances degrade unexpectedly > when we change a tiny thing. > > Having said that, I don't see how opposing a more effective inlining and > specialization strategy would let the programmers write better code. Clearly I'm not opposing anything: just making a point that there is a good reason to have 'dumb' code: not that the reason is universal or pervasive. > Quite the contrary (manual inlining? come on...) in my opinion. Well actually, inlining is a good example to consider IMHO. Good inlining algorithms are very hard. Felix relies *heavily* on inlining to create optimisation opportunities via monomorphisation, parameter replacement, and simply eliminating calling overheads. But still, the algorithm is crude and I found it necessary to allow: fun f ... // maybe inline inline fun f // try REALLY HARD to inline noinline fun f // never inline Whilst this isn't "hand inlining" it is a weak form of manual control over a difficult algorithm. > A functional programmer has reasons to > become schizophrenic if he must ask himself questions such as "should I > make this piece of code a function or write it inline?" hehe .. obviously best to start off schiz, then there's no problem becoming so! :) > or "should I > restrict the type of this polymorphic function?" or "should I use > Array.iter or write a for loop?" all the time. Or .. > MLton's strength is that > you don't have to pay the price for abstraction, i.e. cleaning up your > program (by factorizing it or making it more modular) does not degrade > performance. .. choice of functors vs type variables for polymorphism? Which all SML/Ocaml programmers have .. the language is clearly Schizoid here:) We need a good doctor (theorist) to get rid of this malady. -- John Skaller Felix, successor to C++: http://felix.sf.net