English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] lazy vs function for values that are used once at most
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-06-30 (13:41)
From: Jon Harrop <postmaster@j...>
Subject: Re: [Caml-list] lazy vs function for values that are used once at most

> when one has a value v that is going to be either used 0 or 1 time, is
> there any difference in terms of overhead (ie for building the
> closure,  GC performance, etc) between passing around  (lazy v) and
> then forcing the value if needed, or passing around (fun () -> v) and
> evaluating f when needed?

IIRC, Lazy is slower because of the (wasted, in this case) overhead of 
memoizing the result.


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