From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id QAA20327 for caml-redistribution; Thu, 31 Oct 1996 16:28:50 +0100 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id QAA20266 for ; Thu, 31 Oct 1996 16:26:45 +0100 Received: from margaux.inria.fr (margaux.inria.fr [128.93.8.2]) by concorde.inria.fr (8.7.6/8.7.1) with ESMTP id QAA02174 for ; Thu, 31 Oct 1996 16:26:45 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by margaux.inria.fr (8.7.6/8.7.3) with ESMTP id QAA03142 for ; Thu, 31 Oct 1996 16:26:44 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.7.6/8.7.1) with ESMTP id QAA02170; Thu, 31 Oct 1996 16:26:39 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id QAA20258; Thu, 31 Oct 1996 16:26:38 +0100 From: Xavier Leroy Message-Id: <199610311526.QAA20258@pauillac.inria.fr> Subject: Re: Q: float arrays To: ohl@crunch.ikp.physik.th-darmstadt.de (Thorsten Ohl) Date: Thu, 31 Oct 1996 16:26:38 +0100 (MET) Cc: caml-list@margaux.inria.fr In-Reply-To: <9610301452.AA34276@crunch> from "Thorsten Ohl" at Oct 30, 96 03:52:28 pm MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: weis > I know that I'm asking too much, but wouldn't it be nice it the > compiler did it for me? In the example at hand, > > let f2 = map (function (p,p') -> (p*.p')) > > the compiler could inline the multiplication automagically, iff it > still had access to the definition of the map function. That's right, and I still plan to put some automatic inlining in Objective Caml at some point. However, known inlining strategies are very conservative and err on the safe side in order to avoid code size blowup. This means that if your "map" functional is sufficiently big, it will not be inlined, even though this could resut in important speedups. I'm not trying to discourage anyone from writing polymorphic or higher-order functions: if that makes the program clearer, do it and the performances will be all right most of the time. What I'm saying is that if the performances of your application depend critically on a few functions (say, matrix operations, or a Fourier transform), then one of the first things you should consider to hand-optimize these functions is removing function parameters and avoid polymorphic array accesses. This is much more important performance-wise than, say, removing array bound checks or turning recursive functions into loops. - Xavier Leroy