caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Damien Doligez <Damien.Doligez@inria.fr>
To: caml-list@inria.fr, debourse@email.enst.fr
Subject: Re:  Lazy evaluation & performance
Date: Fri, 3 Mar 2000 13:45:51 +0100	[thread overview]
Message-ID: <200003031245.NAA12637@tobago.inria.fr> (raw)

>From: Benoit de Boursetty <debourse@email.enst.fr>

>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



             reply	other threads:[~2000-03-06 13:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-03-03 12:45 Damien Doligez [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-02-20 12:54 Benoit de Boursetty

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200003031245.NAA12637@tobago.inria.fr \
    --to=damien.doligez@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=debourse@email.enst.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).