testbench 0.2.1.1 → 0.2.1.2
raw patch · 4 files changed
+54/−27 lines, 4 filesdep ~criteriondep ~temporary
Dependency ranges changed: criterion, temporary
Files
- Changelog.md +7/−0
- src/TestBench.hs +24/−16
- src/TestBench/Evaluate.hs +18/−7
- testbench.cabal +5/−4
Changelog.md view
@@ -1,3 +1,10 @@+0.2.1.2 (23 May, 2018)+======================++* Allow building with criterion-0.13.* and 0.14.*++* Allow building with temporary-1.3.*+ 0.2.1.1 (6 February, 2018) ==========================
src/TestBench.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE FlexibleContexts, FlexibleInstances, FunctionalDependencies,+{-# LANGUAGE CPP, FlexibleContexts, FlexibleInstances, FunctionalDependencies, GeneralizedNewtypeDeriving, MultiParamTypeClasses, RecordWildCards #-} @@ -140,6 +140,10 @@ import Options.Applicative (execParser) import System.Exit (exitSuccess) +#if MIN_VERSION_base (4,9,0)+import Data.Semigroup (Semigroup(..))+#endif+ -- ----------------------------------------------------------------------------- -- | An individual operation potentially consisting of a benchmark@@ -480,17 +484,25 @@ , mkOps :: Endo (CompInfo a b) } +#if MIN_VERSION_base (4,9,0)+instance Semigroup (CompParams a b) where+ (<>) = appendCP+#endif+ instance Monoid (CompParams a b) where mempty = CP { withOps = mempty , mkOps = mempty } - mappend cp1 cp2 = CP { withOps = mappendBy withOps- , mkOps = mappendBy mkOps- }- where- mappendBy f = mappend (f cp1) (f cp2)+ mappend = appendCP +appendCP :: CompParams a b -> CompParams a b -> CompParams a b+appendCP cp1 cp2 = CP { withOps = appendBy withOps+ , mkOps = appendBy mkOps+ }+ where+ appendBy f = mappend (f cp1) (f cp2)+ -- | A convenience class to make it easier to provide 'CompParams' -- values. --@@ -616,16 +628,12 @@ -- | Calculate memory usage of the various parameters. ----- This requires running your executable with the @-T@ RTS flag. To--- do so, you can either do:------ * @my-program +RTS -T -RTS@ (may need to add @-rtsopts@ to your--- @ghc-options@ in your .cabal file)------ * Add @-rtsopts -with-rtsopts=-T@ to your `ghc-options` field in--- your .cabal file.------ If this flag is not provided, then this is equivalent to a no-op.+-- Note that to achieve this, 'testBench' and associated functions+-- will run copies of itself to be able to calculate memory usage in+-- a pristine environment (i.e. without influence of caching from+-- testing and benchmarking). As such, you may wish to use the+-- @-threaded@ GHC option when building your benchmarking+-- executable. -- -- @since 0.2.0.0 weigh :: (NFData b) => CompParams a b
src/TestBench/Evaluate.hs view
@@ -1,4 +1,4 @@-{-# LANGUAGE BangPatterns, FlexibleContexts, GADTs, OverloadedStrings,+{-# LANGUAGE BangPatterns, CPP, FlexibleContexts, GADTs, OverloadedStrings, RankNTypes #-} {- |@@ -68,6 +68,10 @@ import System.Process (rawSystem) import Text.Printf (printf) +#if MIN_VERSION_base (4,9,0)+import Data.Semigroup (Semigroup(..))+#endif+ -------------------------------------------------------------------------------- -- | A more explicit tree-like structure for benchmarks than using@@ -162,18 +166,25 @@ } deriving (Eq, Ord, Show, Read) +#if MIN_VERSION_base (4,9,0)+instance Semigroup EvalParams where+ (<>) = appendEP+#endif+ instance Monoid EvalParams where mempty = EP { hasBench = False , hasWeigh = False , nameWidth = 0 }+ mappend = appendEP - mappend ec1 ec2 = EP { hasBench = mappendBy hasBench- , hasWeigh = mappendBy hasWeigh- , nameWidth = nameWidth ec1 `max` nameWidth ec2- }- where- mappendBy f = f ec1 || f ec2+appendEP :: EvalParams -> EvalParams -> EvalParams+appendEP ec1 ec2 = EP { hasBench = appendBy hasBench+ , hasWeigh = appendBy hasWeigh+ , nameWidth = nameWidth ec1 `max` nameWidth ec2+ }+ where+ appendBy f = f ec1 || f ec2 checkForest :: EvalForest -> EvalParams checkForest = mconcat . map (foldLTree mergeNode calcConfig)
testbench.cabal view
@@ -1,5 +1,5 @@ name: testbench-version: 0.2.1.1+version: 0.2.1.2 synopsis: Create tests and benchmarks together description: { Test your benchmarks! Benchmark your tests!@@ -30,7 +30,8 @@ , Changelog.md cabal-version: >=1.10 -tested-with: GHC == 7.10.2, GHC == 8.0.1, GHC == 8.2.2, GHC == 8.3.*+tested-with: GHC == 7.10.2, GHC == 8.0.1, GHC == 8.2.2, GHC == 8.4.1,+ GHC == 8.5.* source-repository head type: git@@ -49,7 +50,7 @@ build-depends: base == 4.* , bytestring , cassava == 0.5.*- , criterion >= 1.2.1.0 && < 1.3+ , criterion >= 1.2.1.0 && < 1.5 , dlist == 0.8.* , deepseq >= 1.1.0.0 && < 1.5 , HUnit >= 1.1 && < 1.7@@ -59,7 +60,7 @@ , streaming == 0.2.* , streaming-cassava == 0.1.* , streaming-with >= 0.1.0.0 && < 0.3- , temporary >= 1.1 && < 1.3+ , temporary >= 1.1 && < 1.4 , transformers , weigh >= 0.0.4 && < 0.1 hs-source-dirs: src