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 LAA23627; Thu, 29 Jul 2004 11:57: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 LAA24116 for ; Thu, 29 Jul 2004 11:57:19 +0200 (MET DST) Received: from yquem.inria.fr (yquem.inria.fr [128.93.8.37]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i6T9vGEV003090; Thu, 29 Jul 2004 11:57:17 +0200 Received: by yquem.inria.fr (Postfix, from userid 18180) id E4AF5BC78; Thu, 29 Jul 2004 11:57:16 +0200 (CEST) Date: Thu, 29 Jul 2004 11:57:16 +0200 From: Xavier Leroy To: Keith Wansbrough Cc: Daniel Andor , Ocaml Subject: Re: [Caml-list] looping recursion Message-ID: <20040729095716.GC13419@yquem.inria.fr> References: <200407291013.12467.da209@cam.ac.uk> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.28i X-Miltered: at nez-perce with ID 4108C9FD.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 lemme:01 ocamlc:01 usr:01 vanilla:01 usr:01 ocamlopt:01 0.81:01 vanilla:01 implemented:01 resizing:01 timings:01 ocaml:01 stack:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > 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) > > OK, so why is List.map in the OCaml standard library implemented the > vanilla way rather than the rev rev_map way? If it's such a big win, > it seems foolish to have a broken implementation for such a crucial > function. Because for smaller list the "vanilla way" is more efficient. In the test above, the vanilla way spends significant time resizing the stack. I suspect that when running it a second time on a already resized stack, the timings would improve quite a lot. - Xavier Leroy ------------------- 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