From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA19403; Sat, 31 Jul 2004 19:06:20 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id TAA19051 for ; Sat, 31 Jul 2004 19:06:19 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6VH6GEV032765 for ; Sat, 31 Jul 2004 19:06:18 +0200 Received: from [192.168.1.200] (ppp205-61.lns1.syd3.internode.on.net [203.122.205.61]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i6VH5r4Y091701; Sun, 1 Aug 2004 02:35:54 +0930 (CST) Subject: Re: [Caml-list] const equivalent for mutable types? From: skaller Reply-To: skaller@users.sourceforge.net To: Brian Hurt Cc: Markus Mottl , Jean-Marie Gaillourdert , caml-list In-Reply-To: References: Content-Type: text/plain Message-Id: <1091293552.11540.399.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 01 Aug 2004 03:05:53 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 410BD188.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 const:01 sourceforge:01 2004:99 inlines:01 recursively:01 inlines:01 inlining:01 inlined:01 inlined:01 caching:01 inlining:01 9660:01 glebe:01 inefficient:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sun, 2004-08-01 at 00:31, Brian Hurt wrote: > > This way lies hell. Balance is the key. I have in fact just converted a functional algorithm to an imperative one. Its the Felix inliner (which inlines functions). What happens is I replace a function call with the body of the function being called with the argument replacing the parameter. The purely functional algorithm was inefficient: it has to inline recursively, and in doing so, it inlines the same function calls multiple times, because there are multiple calls. It is faster to 'cache' any inlining done into a function so when *it* is called the inlined version can be inlined. The easiest way to do this caching is simply replace the function into which inlining is done with the inlined version :) -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners