summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <fiddlosopher@gmail.com>2012-07-27 11:13:18 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2012-07-27 11:13:18 -0700
commitfc738c631551b388824448522aef818cc5b65bb9 (patch)
tree3f29a60b931669ee508c6b89910233208fd0a492
parent5b6e70c3b5725979cc8162cfa0659e4e93a5d538 (diff)
Benchmark: default to sample size of 20 for speed.
-rw-r--r--benchmark/benchmark-pandoc.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index 90b0eee74..7dbd29bed 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -1,8 +1,11 @@
import Text.Pandoc
import Text.Pandoc.Shared (readDataFile, normalize)
import Criterion.Main
+import Criterion.Config
import Data.List (isSuffixOf)
import Text.JSON.Generic
+import System.Environment (getArgs)
+import Data.Monoid
readerBench :: Pandoc
-> (String, ReaderOptions -> String -> Pandoc)
@@ -37,12 +40,14 @@ normalizeBench doc = [ bench "normalize - with" $ nf (encodeJSON . normalize) do
main :: IO ()
main = do
+ args <- getArgs
+ (conf,_) <- parseArgs defaultConfig{ cfgSamples = Last $ Just 20 } defaultOptions args
inp <- readDataFile (Just ".") "README"
inp2 <- readDataFile (Just ".") "tests/testsuite.txt"
let opts = def{ readerSmart = True }
let doc = readMarkdown opts $ inp ++ unlines (drop 3 $ lines inp2)
let readerBs = map (readerBench doc) readers
let writers' = [(n,w) | (n, PureStringWriter w) <- writers]
- defaultMain $
+ defaultMainWith conf (return ()) $
map (writerBench doc) writers' ++ readerBs ++ normalizeBench doc