[Haskell-cafe] Timing pure functions?

wren ng thornton wren at freegeek.org
Wed May 27 11:57:35 EDT 2009


Johan Tibell wrote:
> austin s wrote:
> >  Perhaps benchpress would be more to your liking:
> >
> >  http://hackage.haskell.org/cgi-bin/hackage-scripts/package/benchpress
> 
> Note that since benchpress measures every single invocation of the provided
> IO action in order to compute percentiles it's not good at measuring the
> execution times of small functions as the timing overhead dominates in those
> cases.


For small functions, microbench is another good option:

   http://hackage.haskell.org/cgi-bin/hackage-scripts/package/microbench


When comparing functions with large multiplicative discrepancies in 
runtime, it can give erroneous answers due to Int overflow. Modifying it 
to use Integers instead fixes the bug a some overhead cost. (Perhaps 
both versions could be offered by the package?)

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list