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 PAA02733; Wed, 19 May 2004 15:11:45 +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 PAA02796 for ; Wed, 19 May 2004 15:11:44 +0200 (MET DST) Received: from calmail-cr.berkeley.edu (mailfarm.Berkeley.EDU [128.32.61.106]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i4JDBgEV001608 for ; Wed, 19 May 2004 15:11:43 +0200 Received: from [64.162.212.212] (HELO tallman.kefka.frap.net) by calmail-cr.berkeley.edu (CommuniGate Pro SMTP 4.1.8) with SMTP id 30222580; Wed, 19 May 2004 06:11:39 -0700 Received: by tallman.kefka.frap.net (sSMTP sendmail emulation); Wed, 19 May 2004 06:09:28 -0700 Date: Wed, 19 May 2004 06:09:28 -0700 From: Kenneth Knowles To: "Vladimir N. Silyaev" Cc: caml-list@inria.fr Subject: [Caml-list] Re: Lazy vs closure Message-ID: <20040519130928.GA25420@tallman.kefka.frap.net> References: <20040519062157.GA65076@server.vns.oc.ca.us> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040519062157.GA65076@server.vns.oc.ca.us> User-Agent: Mutt/1.5.6i X-Miltered: at nez-perce with ID 40AB5D0E.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; knowles:99 closures:01 bookkeeping:01 memoizing:01 2004:99 slower:01 coredumps:01 computed:01 0700,:01 byte:01 closure:01 closure:01 lazy:02 lazy:02 native:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Your test_lazy creates a new lazy value each time. The thing that might make Lazy faster than closure (or rather, _should_ make it faster) is if you evaluate the same value multiple times, because it is only computed once. The slowdown compared to closures is probably the bookkeeping necessary for this memoizing. Kenn On Tue, May 18, 2004 at 11:21:57PM -0700, Vladimir N. Silyaev wrote: > After reading list and seeing statement that lazy/Lazy.force is faster then > closure/apply, I've decided to run microbenchmark with both. > Results are rather confusing: > Byte code - Lazy is three times slower than closure > Native code (x86) - it's either coredumps or leaks memory ------------------- 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