Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] Lazy vs closure
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2004-05-19 (13:11)
From: Kenneth Knowles <kknowles@b...>
Subject: [Caml-list] Re: Lazy vs closure

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.


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 Archives:
Bug reports: FAQ:
Beginner's list: