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 MAA24638; Thu, 29 Jul 2004 12:12:09 +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 MAA24783 for ; Thu, 29 Jul 2004 12:12:07 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6TAC4EV004573 for ; Thu, 29 Jul 2004 12:12:06 +0200 Received: from [192.168.1.200] (ppp205-61.lns1.syd3.internode.on.net [203.122.205.61]) by smtp3.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i6TABwHY000378; Thu, 29 Jul 2004 19:41:58 +0930 (CST) Subject: Re: [Caml-list] looping recursion From: skaller Reply-To: skaller@users.sourceforge.net To: Daniel Andor Cc: Ocaml In-Reply-To: <200407291013.12467.da209@cam.ac.uk> References: <16646.64470.304530.264731@soggy.deldotd.com> <200407282040.40600.jon@jdh30.plus.com> <200407291013.12467.da209@cam.ac.uk> Content-Type: text/plain Message-Id: <1091095917.5870.1296.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 29 Jul 2004 20:11:57 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4108CD74.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 recursion:01 sourceforge:01 2004:99 lemme:01 ocamlc:01 usr:01 vanilla:01 usr:01 ocamlopt:01 0.81:01 vanilla:01 unexpected:01 tail-rec:01 shrinking:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 2004-07-29 at 19:13, Daniel Andor wrote: > Lemme try it out (10^6 elements): > > ocamlc: > rev rev_map version: > 2 WALL ( 1.19 usr + 0.02 sys = 1.21 CPU) > vanilla map: > 7 WALL ( 6.50 usr + 0.09 sys = 6.59 CPU) > > ocamlopt: > rev rev_map version: > 1 WALL ( 0.81 usr + 0.03 sys = 0.84 CPU) > vanilla map: > 2 WALL ( 2.45 usr + 0.02 sys = 2.47 CPU) > > Wow, that was unexpected! The tail-rec version doesn't clobber the cache with growing and shrinking stack -- you have two areas of memory being accessed sequentially instead of three .. (Ocaml allocator is sequential) -- 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