From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id OAA19902 for caml-redistribution@pauillac.inria.fr; Mon, 6 Mar 2000 14:09:55 +0100 (MET) Resent-Message-Id: <200003061309.OAA19902@pauillac.inria.fr> 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 NAA12630 for ; Fri, 3 Mar 2000 13:45:55 +0100 (MET) Received: from tobago.inria.fr (tobago.inria.fr [128.93.8.21]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id NAA13740; Fri, 3 Mar 2000 13:45:54 +0100 (MET) Received: (from doligez@localhost) by tobago.inria.fr (8.6.10/8.6.6) id NAA12637; Fri, 3 Mar 2000 13:45:51 +0100 Date: Fri, 3 Mar 2000 13:45:51 +0100 From: Damien Doligez Message-Id: <200003031245.NAA12637@tobago.inria.fr> To: caml-list@inria.fr, debourse@email.enst.fr Subject: Re: Lazy evaluation & performance Resent-From: weis@pauillac.inria.fr Resent-Date: Mon, 6 Mar 2000 14:09:55 +0100 Resent-To: caml-redistribution@pauillac.inria.fr >From: Benoit de Boursetty >Has anybody done benchmarks to eval the cost of lazy computation >encapsulation, in terms of time, memory, garbage collection? I have no >idea of how this is implemented... In all the versions of O'Caml so far, lazy (some expression) is exactly equivalent to Pervasives.ref (Lazy.Delayed (fun () -> (some expression))) . >Could anybody give me a hint about the order of magnitude of L? Memory: two one-field blocks plus a closure (arbitrarily big, depending on the free variables of your expression). Time: whatever it takes to allocate the above, i.e. not much. Certainly less than a dozen flops. Maybe even less than one flop, but that may depend on the compiler (bytecode or native) and on the architecture. -- Damien