From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id IAA01764 for caml-redistribution@pauillac.inria.fr; Fri, 4 Feb 2000 08:48:45 +0100 (MET) Resent-Message-Id: <200002040748.IAA01764@pauillac.inria.fr> Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA20955 for ; Thu, 3 Feb 2000 19:38:41 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id TAA28390; Thu, 3 Feb 2000 19:38:39 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA26517; Thu, 3 Feb 2000 19:38:38 +0100 (MET) Message-ID: <20000203193838.23474@pauillac.inria.fr> Date: Thu, 3 Feb 2000 19:38:38 +0100 From: Xavier Leroy To: Stephan Houben , caml-list@inria.fr Subject: Re: inlining functions called through functor parameters? References: <20000131103447.A16550@pcrm.win.tue.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1 In-Reply-To: <20000131103447.A16550@pcrm.win.tue.nl>; from Stephan Houben on Mon, Jan 31, 2000 at 10:34:47AM +0100 Resent-From: weis@pauillac.inria.fr Resent-Date: Fri, 4 Feb 2000 08:48:45 +0100 Resent-To: caml-redistribution@pauillac.inria.fr > While searching the Caml mailing list archive, I found > a message from Xavier Leroy, posted on Tue Jun 23 1998, > in which he describes the fact that: > "... it is true that functions taken from the > functor parameter are always called via their closures". > I was wondering if this is still true (since 1998 is a long > time ago, in internet time at least), and if there are any plans > to implement more inlining for such functions. Yes, this is still true. So far, the body of a functor is compiled only once (at the point where it's defined), and this precludes inlining of the functions contained in the functor parameter (consider two applications of the functor). > The reason I ask is because I'm writing a couple of modules where > lots of small funtions are called via a functor parameter, and > I'm wondering if it's worth the trouble to inline them "by hand". If the functor is applied only once, you could turn it into a structure that references directly its argument; this will enable automatic inlining. Otherwise, and assuming that's the performance bottleneck in your program, it could be worth the effort to inline manually some of the functions. All the best, - Xavier Leroy