[Haskell-cafe] Timing pure functions?

2009-05-27 Thread Magnus Therning
Yesterday I spent about 5 minutes trying to time a single function in haskell (after having spent about 30 minutes on the timeit module in Python). I found timeit[1] on Hackage but it only times an IO computation once, what I'd like to do is time a pure function several times. Timing it once was

Re: [Haskell-cafe] Timing pure functions?

2009-05-27 Thread Andrew Butterfield
Magnus Therning wrote: timeIt times ioa = let timeOnce = do t1 - getCPUTime a - ioa t2 - getCPUTime let t = fromIntegral (t2-t1) * 1e-12 return t in sequence $ take times $ repeat timeOnce main = do

Re: [Haskell-cafe] Timing pure functions?

2009-05-27 Thread Magnus Therning
On Wed, May 27, 2009 at 9:59 AM, Andrew Butterfield andrew.butterfi...@cs.tcd.ie wrote: Magnus Therning wrote:  timeIt times ioa = let          timeOnce = do              t1 - getCPUTime              a - ioa              t2 - getCPUTime              let t = fromIntegral (t2-t1) * 1e-12    

Re: [Haskell-cafe] Timing pure functions?

2009-05-27 Thread austin s
Excerpts from Magnus Therning's message of Wed May 27 03:51:19 -0500 2009: Yesterday I spent about 5 minutes trying to time a single function in haskell (after having spent about 30 minutes on the timeit module in Python). I found timeit[1] on Hackage but it only times an IO computation once,

Re: [Haskell-cafe] Timing pure functions?

2009-05-27 Thread Johan Tibell
On Wed, May 27, 2009 at 12:02 PM, austin s a...@nijoruj.org 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

Re: [Haskell-cafe] Timing pure functions?

2009-05-27 Thread wren ng thornton
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