Skip to content

Commit

Permalink
bump criterion to 1.0 API for benchmark
Browse files Browse the repository at this point in the history
  • Loading branch information
timtylin committed Feb 7, 2015
1 parent 8628b4b commit 623cf99
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ To run the benchmarks:

make bench

To use a smaller sample size so the benchmarks run faster:
To change the time allowed for each reader/writer benchmark:

cabal bench --benchmark-options='-s 20'
cabal bench --benchmark-options='--time-limit 1.0'

To run just the markdown benchmarks:

Expand Down
12 changes: 4 additions & 8 deletions benchmark/benchmark-scholdoc.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-
Copyright (C) 2012-2014 John MacFarlane <[email protected]>
Copyright (C) 2015 Tim T.Y. Lin <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Expand All @@ -17,9 +18,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-}
import Text.Pandoc
import Criterion.Main
import Criterion.Config
import System.Environment (getArgs)
import Data.Monoid
import Criterion.Types
import Data.Maybe (mapMaybe)
import Debug.Trace (trace)

Expand All @@ -41,9 +40,6 @@ writerBench doc (name, writer) = bench (name ++ " writer") $ nf

main :: IO ()
main = do
args <- getArgs
(conf,_) <- parseArgs defaultConfig{ cfgSamples = Last $ Just 20 }
defaultOptions args
inp <- readFile "tests/testsuite.txt"
let opts = def{ readerSmart = True }
let doc = readMarkdown opts inp
Expand All @@ -53,5 +49,5 @@ main = do
let writers' = [(n,w) | (n, PureStringWriter w) <- writers]
let writerBs = map (writerBench doc)
$ writers'
defaultMainWith conf (return ()) $
writerBs ++ readerBs
let conf = defaultConfig { timeLimit = 2.0 }
defaultMainWith conf $ writerBs ++ readerBs
2 changes: 1 addition & 1 deletion scholdoc.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,6 @@ benchmark benchmark-scholdoc
Hs-Source-Dirs: benchmark
Build-Depends: scholdoc,
base >= 4.2 && < 5,
criterion >= 0.5 && < 0.9
criterion >= 1.0.0.1 && < 1.1
Ghc-Options: -rtsopts -Wall -fno-warn-unused-do-bind
Default-Language: Haskell98

0 comments on commit 623cf99

Please sign in to comment.