criterion 1.0.0.2 → 1.0.1.0
raw patch · 4 files changed
+72/−22 lines, 4 filesdep ~optparse-applicativePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: optparse-applicative
API changes (from Hackage documentation)
Files
- Criterion/Main/Options.hs +22/−20
- changelog.md +4/−0
- criterion.cabal +4/−2
- tests/Properties.hs +42/−0
Criterion/Main/Options.hs view
@@ -89,30 +89,31 @@ (Version <$ switch (long "version" <> help "show version info")) where onlyRun = matchNames $- OnlyRun <$> option (long "only-run" <> short 'n' <> metavar "ITERS" <>- help "run benchmarks, don't analyse")+ OnlyRun <$> option auto+ (long "only-run" <> short 'n' <> metavar "ITERS" <>+ help "run benchmarks, don't analyse") matchNames wat = wat- <*> option (long "match" <> short 'm' <> metavar "MATCH" <>- value Prefix <> reader match <>- help "how to match benchmark names")+ <*> option match+ (long "match" <> short 'm' <> metavar "MATCH" <> value Prefix <>+ help "how to match benchmark names") <*> many (argument str (metavar "NAME...")) config :: Config -> Parser Config config Config{..} = Config- <$> option (long "ci" <> short 'I' <> metavar "CI" <> value confInterval <>- reader (range 0.001 0.999) <>- help "confidence interval")+ <$> option (range 0.001 0.999)+ (long "ci" <> short 'I' <> metavar "CI" <> value confInterval <>+ help "confidence interval") <*> (not <$> switch (long "no-gc" <> short 'G' <> help "do not collect garbage between iterations"))- <*> option (long "time-limit" <> short 'L' <> metavar "SECS" <>- value timeLimit <> reader (range 0.1 86400) <>- help "time limit to run a benchmark")- <*> option (long "resamples" <> metavar "COUNT" <> value resamples <>- reader (range 1 1000000) <>- help "number of bootstrap resamples to perform")- <*> many (option (long "regress" <> metavar "RESP:PRED.." <>- reader regressParams <>- help "regressions to perform"))+ <*> option (range 0.1 86400)+ (long "time-limit" <> short 'L' <> metavar "SECS" <> value timeLimit <>+ help "time limit to run a benchmark")+ <*> option (range 1 1000000)+ (long "resamples" <> metavar "COUNT" <> value resamples <>+ help "number of bootstrap resamples to perform")+ <*> many (option regressParams+ (long "regress" <> metavar "RESP:PRED.." <>+ help "regressions to perform")) <*> outputOption rawDataFile (long "raw" <> help "file to write raw data to") <*> outputOption reportFile (long "output" <> short 'o' <>@@ -121,9 +122,10 @@ help "file to write CSV summary to") <*> outputOption junitFile (long "junit" <> help "file to write JUnit summary to")- <*> (toEnum <$> option (long "verbosity" <> short 'v' <> metavar "LEVEL" <>- value (fromEnum verbosity) <> reader (range 0 2) <>- help "verbosity level"))+ <*> (toEnum <$> option (range 0 2)+ (long "verbosity" <> short 'v' <> metavar "LEVEL" <>+ value (fromEnum verbosity) <>+ help "verbosity level")) <*> strOption (long "template" <> short 't' <> metavar "FILE" <> value template <> help "template to use for report")
+ changelog.md view
@@ -0,0 +1,4 @@+1.0.1.0++* Added a lower bound of 0.10 on the optparse-applicative dependency,+ as there were major API changes between 0.9 and 0.10.
criterion.cabal view
@@ -1,5 +1,5 @@ name: criterion-version: 1.0.0.2+version: 1.0.1.0 synopsis: Robust, reliable performance measurement and analysis license: BSD3 license-file: LICENSE@@ -13,6 +13,7 @@ cabal-version: >= 1.8 extra-source-files: README.markdown+ changelog.md examples/*.cabal examples/*.hs examples/*.html@@ -86,7 +87,7 @@ hastache >= 0.6.0, mtl >= 2, mwc-random >= 0.8.0.3,- optparse-applicative,+ optparse-applicative >= 0.10, parsec >= 3.1.0, statistics >= 0.13.2.1, text >= 0.11,@@ -131,6 +132,7 @@ type: exitcode-stdio-1.0 hs-source-dirs: tests main-is: Tests.hs+ other-modules: Properties ghc-options: -Wall -threaded -O0 -rtsopts
+ tests/Properties.hs view
@@ -0,0 +1,42 @@+{-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -fno-warn-orphans #-}++module Properties (tests) where++import Control.Applicative ((<$>))+import Criterion.Analysis+import Statistics.Types (Sample)+import Test.Framework (Test, testGroup)+import Test.Framework.Providers.QuickCheck2 (testProperty)+import Test.QuickCheck+import qualified Data.Vector.Generic as G+import qualified Data.Vector.Unboxed as U++#if __GLASGOW_HASKELL__ >= 704+import Data.Monoid ((<>))+#else+import Data.Monoid++(<>) :: Monoid m => m -> m -> m+(<>) = mappend+infixr 6 <>+#endif++instance (Arbitrary a, U.Unbox a) => Arbitrary (U.Vector a) where+ arbitrary = U.fromList <$> arbitrary+ shrink = map U.fromList . shrink . U.toList++outlier_bucketing :: Double -> Sample -> Bool+outlier_bucketing y ys =+ countOutliers (classifyOutliers xs) <= fromIntegral (G.length xs)+ where xs = U.cons y ys++outlier_bucketing_weighted :: Double -> Sample -> Bool+outlier_bucketing_weighted x xs =+ outlier_bucketing x (xs <> G.replicate (G.length xs * 10) 0)++tests :: Test+tests = testGroup "Properties" [+ testProperty "outlier_bucketing" outlier_bucketing+ , testProperty "outlier_bucketing_weighted" outlier_bucketing_weighted+ ]