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 OAA30378; Thu, 29 Jul 2004 14:41:05 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 OAA29991 for ; Thu, 29 Jul 2004 14:41:03 +0200 (MET DST) Received: from mail2.speakeasy.net (mail2.speakeasy.net [216.254.0.202]) by concorde.inria.fr (8.12.10/8.12.10) with ESMTP id i6TCf2SH020900 for ; Thu, 29 Jul 2004 14:41:02 +0200 Received: (qmail 22145 invoked from network); 29 Jul 2004 12:41:01 -0000 Received: from shell1.speakeasy.net ([69.17.110.70]) (envelope-sender ) by mail2.speakeasy.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP for ; 29 Jul 2004 12:41:01 -0000 Date: Thu, 29 Jul 2004 05:41:01 -0700 (PDT) From: brogoff To: Daniel Andor cc: Ocaml Subject: Re: [Caml-list] looping recursion In-Reply-To: <200407291013.12467.da209@cam.ac.uk> Message-ID: References: <16646.64470.304530.264731@soggy.deldotd.com> <200407282040.40600.jon@jdh30.plus.com> <200407291013.12467.da209@cam.ac.uk> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Miltered: at concorde with ID 4108F05E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; brogoff:01 brogoff:01 caml-list:01 recursion:01 2004:99 2004:99 38,:01 000,:01 damned:01 lemme:01 ocamlc:01 usr:01 vanilla:01 usr:01 ocamlopt:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Thu, 29 Jul 2004, Daniel Andor wrote: > On Wednesday 28 July 2004 10:22 pm, brogoff wrote: > > On Wed, 28 Jul 2004, Jon Harrop wrote: > > > On Wednesday 28 July 2004 17:38, brogoff wrote: > > > > > brogoff wrote: > > > > > > Sometimes lists are best. If lists are OK for 100, 1_000, or 10_000 > > > > > > items, why not 100_000 or 1_000_000? Map and friends shouldn't blow > > > > > > stack. > [...] > > > What's wrong with List.rev_map, List.rev (List.rev_map ...), increasing > > > the size of the VM's stack, using native code or even writing your own, > > > tail-recursive map? > > > > I'm pretty damned well aware that I can reverse a rev mapped list. > > If you've got the mutable list version of map to hand, and you are happy with > that, then that's clearly the way to go. And I said as much. I also said it offends my sense of aesthetics ;-). > 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! > > > Does it occur to you that that is not efficient? > > Not any more! You neglected the "mutable" list version in your quickie benchmark. My own quickie benchmark showed that version had better performance than the doubly reversing implementation on large lists and very slightly better performance than the default on small ones. I would expect that if something like holes or promises (a la Alice SML) or whatever were in OCaml, that under the hood it would be the same as the mutable list version and so would have equivalent performance. -- Brian ------------------- 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