packages feed

benchpress 0.2.2.25 → 0.2.3.0

raw patch · 2 files changed

+19/−9 lines, 2 filesdep ~timePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: time

API changes (from Hackage documentation)

+ Test.BenchPress: benchmarkWithResults :: Int -> IO a -> (a -> IO b) -> (a -> IO c) -> IO ([c], Stats, Stats)

Files

Test/BenchPress.hs view
@@ -49,6 +49,7 @@ module Test.BenchPress     ( -- * Running a benchmark       benchmark,+      benchmarkWithResults,       bench,       benchMany, @@ -80,11 +81,16 @@ -- statistics for both the measured CPU times and wall clock times, in -- that order. benchmark :: Int -> IO a -> (a -> IO b) -> (a -> IO c) -> IO (Stats, Stats)-benchmark iters setup teardown action =+benchmark iters setup teardown action = do+  (_, cpu, wall) <- benchmarkWithResults iters setup teardown action+  pure (cpu, wall)++benchmarkWithResults :: Int -> IO a -> (a -> IO b) -> (a -> IO c) -> IO ([c], Stats, Stats)+benchmarkWithResults iters setup teardown action =   if iters < 1     then error "benchmark: iters must be greater than 0"     else do-      (cpuTimes, wallTimes) <- unzip `fmap` go iters+      (results, cpuTimes, wallTimes) <- unzip3 `fmap` go iters       let xs        = sort cpuTimes           cpuStats  = Stats                       { min         = head xs@@ -103,18 +109,22 @@                       , max         = last ys                       , percentiles = percentiles' ys                       }-      return (cpuStats, wallStats)+      return (results, cpuStats, wallStats)       where         go 0 = return []         go n = do           elapsed <- bracket setup teardown $ \a -> do             startWall <- getCurrentTime             startCpu <- getCPUTime-            _ <- action a+            result <- action a             endCpu <- getCPUTime             endWall <- getCurrentTime-            return (picosToMillis $! endCpu - startCpu-                   ,secsToMillis $! endWall `diffUTCTime` startWall)+            let+              cpuTime = picosToMillis $! endCpu - startCpu+              wallTime = secsToMillis $! endWall `diffUTCTime` startWall+            return (result+                   , cpuTime+                   , wallTime)           timings <- go $! n - 1           return $ elapsed : timings 
benchpress.cabal view
@@ -1,5 +1,5 @@ name:           benchpress-version:        0.2.2.25+version:        0.2.3.0 synopsis:       Micro-benchmarking with detailed statistics. Description:    Benchmarks actions and produces statistics                 such as min, mean, median, standard deviation,@@ -22,7 +22,7 @@    build-depends:  base >= 2.0 && < 4.22,                   mtl >= 1 && < 2.4,-                  time >= 1 && < 1.15+                  time >= 1 && < 1.16    default-language:  Haskell2010 @@ -39,7 +39,7 @@    build-depends:  base >= 2.0 && < 4.22,                   bytestring >= 0.12 && < 0.13,-                  time >= 1 && < 1.15+                  time >= 1 && < 1.16    default-language:  Haskell2010