[Haskell-cafe] ANNOUNCE: StrictBench 0.1 - Benchmarking code
through strict evaluation
r.a.niemeijer at tue.nl
Mon Jun 8 03:20:30 EDT 2009
In the last month or so, I've found myself using the following snippet a lot:
bench 1 . print . rnf
This snippet fully evaluates a value and prints how long it took to do so. I regularly use it to see where the bottlenecks lie in my algorithms. It has the minor annoyance, however, that it prints a lot of information (min, max, mean, median, percentiles) that is all identical, because I only run it once. The reason I only run it once is that I'm typically evaluating a pure value, which means that any subsequent attempts to benchmark the evaluation time will take no time at all, since it has already been evaluated.
To solve this, I decided to write a small library to make this process easier and only print the time taken once. The result is StrictBench, which can be found at http://hackage.haskell.org/cgi-bin/hackage-scripts/package/StrictBench.
A short example:
main = bench [1..10000000 :: Integer]
This code would give
as output. For the rest of the documentation I refer you to the Hackage page.
More information about the Haskell-Cafe