Reliably preventing let-floating and thunk overwriting?

Bryan O'Sullivan bos at serpentine.com
Fri Nov 6 00:39:10 EST 2009


The criterion benchmarking package is pretty nice to use in general, but it
has a property that sticks in my craw: ensuring that pure code actually gets
evaluated on every iteration through the benchmarking loop is awkward and
fragile.

My current scheme is to increment an Int on every iteration and pass that to
the function being benchmarked. I document the need for the function to
somehow use this Int, lest it be let-floated out to the top level, where it
will be evaluated just once and our measurements will become nonsensical.

I wonder if anyone else has any clever ideas about approaches that might be
less intrusive in the API.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20091106/3d3f177c/attachment.html


More information about the Glasgow-haskell-users mailing list