criterion 0.5.0.1 → 0.5.0.2
raw patch · 6 files changed
+27/−28 lines, 6 filesdep ~mwc-randomdep ~statisticsdep ~vectorPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: mwc-random, statistics, vector, vector-algorithms
API changes (from Hackage documentation)
Files
- Criterion.hs +8/−8
- Criterion/Analysis.hs +2/−2
- Criterion/Environment.hs +4/−4
- Criterion/Main.hs +7/−6
- Criterion/Measurement.hs +1/−1
- criterion.cabal +5/−7
Criterion.hs view
@@ -51,16 +51,16 @@ -- executing it. runBenchmark :: Benchmarkable b => Environment -> b -> Criterion Sample runBenchmark env b = do- liftIO $ runForAtLeast 0.1 10000 (`replicateM_` getTime)+ _ <- liftIO $ runForAtLeast 0.1 10000 (`replicateM_` getTime) let minTime = envClockResolution env * 1000 (testTime, testIters, _) <- liftIO $ runForAtLeast (min minTime 0.1) 1 (run b)- prolix "ran %d iterations in %s\n" testIters (secs testTime)+ _ <- prolix "ran %d iterations in %s\n" testIters (secs testTime) cfg <- getConfig let newIters = ceiling $ minTime * testItersD / testTime sampleCount = fromLJ cfgSamples cfg newItersD = fromIntegral newIters testItersD = fromIntegral testIters- note "collecting %d samples, %d iterations each, in estimated %s\n"+ _ <- note "collecting %d samples, %d iterations each, in estimated %s\n" sampleCount newIters (secs (fromIntegral sampleCount * newItersD * testTime / testItersD)) times <- liftIO . fmap (U.map ((/ newItersD) . subtract (envClockCost env))) .@@ -77,7 +77,7 @@ let numSamples = U.length times let ests = [mean,stdDev] numResamples <- getConfigItem $ fromLJ cfgResamples- note "bootstrapping with %d resamples\n" numResamples+ _ <- note "bootstrapping with %d resamples\n" numResamples res <- liftIO . withSystemRandom $ \gen -> resample gen ests numResamples times :: IO [Resample] ci <- getConfigItem $ fromLJ cfgConfInterval@@ -93,11 +93,11 @@ bs "std dev" es summary "\n" noteOutliers (classifyOutliers times)- note "variance introduced by outliers: %.3f%%\n" (v * 100)- note "variance is %s by outliers\n" wibble+ _ <- note "variance introduced by outliers: %.3f%%\n" (v * 100)+ _ <- note "variance is %s by outliers\n" wibble return times where bs :: String -> Estimate -> Criterion ()- bs d e = do note "%s: %s, lb %s, ub %s, ci %.3f\n" d+ bs d e = do _ <- note "%s: %s, lb %s, ub %s, ci %.3f\n" d (secs $ estPoint e) (secs $ estLowerBound e) (secs $ estUpperBound e) (estConfidenceLevel e)@@ -129,7 +129,7 @@ -> Criterion () runAndAnalyse p env = plotAll <=< go "" where go pfx (Benchmark desc b)- | p desc' = do note "\nbenchmarking %s\n" desc'+ | p desc' = do _ <- note "\nbenchmarking %s\n" desc' summary (show desc' ++ ",") -- String will be quoted x <- runAndAnalyseOne env desc' b sameAxis <- getConfigItem $ fromLJ cfgPlotSameAxis
Criterion/Analysis.hs view
@@ -128,7 +128,7 @@ -> Criterion Double analyseMean a iters = do let µ = mean a- note "mean is %s (%d iterations)\n" (secs µ) iters+ _ <- note "mean is %s (%d iterations)\n" (secs µ) iters noteOutliers . classifyOutliers $ a return µ @@ -141,7 +141,7 @@ note " %d (%.1g%%) %s\n" k (frac k) d outCount = countOutliers o when (outCount > 0) $ do- note "found %d outliers among %d samples (%.1g%%)\n"+ _ <- note "found %d outliers among %d samples (%.1g%%)\n" outCount (samplesSeen o) (frac outCount) check (lowSevere o) 0 "low severe" check (lowMild o) 1 "low mild"
Criterion/Environment.hs view
@@ -38,12 +38,12 @@ -- | Measure the execution environment. measureEnvironment :: Criterion Environment measureEnvironment = do- note "warming up\n"+ _ <- note "warming up\n" (_, seed, _) <- liftIO $ runForAtLeast 0.1 10000 resolution- note "estimating clock resolution...\n"+ _ <- note "estimating clock resolution...\n" clockRes <- thd3 `fmap` liftIO (runForAtLeast 0.5 seed resolution) >>= uncurry analyseMean- note "estimating cost of a clock call...\n"+ _ <- note "estimating cost of a clock call...\n" clockCost <- cost (min (100000 * clockRes) 1) >>= uncurry analyseMean return $ Environment { envClockResolution = clockRes@@ -56,7 +56,7 @@ U.length times) cost timeLimit = liftIO $ do let timeClock k = time_ (replicateM_ k getTime)- timeClock 1+ _ <- timeClock 1 (_, iters, elapsed) <- runForAtLeast 0.01 10000 timeClock times <- create (ceiling (timeLimit / elapsed)) $ \_ -> timeClock iters return (U.map (/ fromIntegral iters) times, U.length times)
Criterion/Main.hs view
@@ -70,13 +70,13 @@ `mplus` try (dim "svg" SVG 432 324) `mplus` (string "csv" >> return CSV) where dim s c dx dy = do- string s+ _ <- string s try (uncurry c `fmap` dimensions) `mplus` (eof >> return (c dx dy)) dimensions = do- char ':'+ _ <- char ':' a <- many1 digit- char 'x'+ _ <- char 'x' b <- many1 digit case (reads a, reads b) of ([(x,[])],[(y,[])]) -> return (x, y)@@ -214,6 +214,7 @@ -- -- > import Criterion.Config -- > import qualified Criterion.MultiMap as M+-- > import Criterion.Main -- > -- > myConfig = defaultConfig { -- > -- Always display an 800x600 window with curves.@@ -240,7 +241,7 @@ withConfig cfg $ if cfgPrintExit cfg == List then do- note "Benchmarks:\n"+ _ <- note "Benchmarks:\n" mapM_ (note " %s\n") (sort $ concatMap benchNames bs) else do case getLast $ cfgSummaryFile cfg of@@ -255,8 +256,8 @@ -- exit. parseError :: String -> IO a parseError msg = do- printError "Error: %s" msg- printError "Run \"%s --help\" for usage information\n" =<< getProgName+ _ <- printError "Error: %s" msg+ _ <- printError "Run \"%s --help\" for usage information\n" =<< getProgName exitWith (ExitFailure 64) -- $bench
Criterion/Measurement.hs view
@@ -35,7 +35,7 @@ time_ :: IO a -> IO Double time_ act = do start <- getTime- act+ _ <- act end <- getTime return $! end - start
criterion.cabal view
@@ -1,5 +1,5 @@ name: criterion-version: 0.5.0.1+version: 0.5.0.2 synopsis: Robust, reliable performance measurement and analysis license: BSD3 license-file: LICENSE@@ -51,13 +51,13 @@ deepseq >= 1.1.0.0, filepath, mtl,- mwc-random >= 0.5.0.0,+ mwc-random >= 0.5.1.4, parallel, parsec >= 3.1.0,- statistics >= 0.5.1.0,+ statistics >= 0.6.0.1, time,- vector >= 0.5,- vector-algorithms >= 0.3+ vector >= 0.6.0.2,+ vector-algorithms >= 0.3.2 if flag(chart) build-depends:@@ -71,5 +71,3 @@ ghc-options: -Wall -funbox-strict-fields if impl(ghc >= 6.8) ghc-options: -fwarn-tabs- if impl(ghc >= 6.12)- ghc-options: -fno-warn-unused-do-bind