aboutsummaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-12-30 11:22:55 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2017-12-30 11:22:55 -0800
commit07b06cb6e6948df98fb3ffe1e9c2673db158feb2 (patch)
tree83f0da318d6be2a84e1c80f76b695aa79037a0ed /benchmark
parentd5d6c9876da21e47bfb9d274648f27ea091ffa52 (diff)
downloadpandoc-07b06cb6e6948df98fb3ffe1e9c2673db158feb2.tar.gz
Improved benchmark argument parsing.
You can now say 'make bench BENCHARGS="markdown latex reader"' and both the markdown and latex readers will be benchmarked.
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/benchmark-pandoc.hs15
1 files changed, 5 insertions, 10 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index 6b6e1a0bc..4d5c67c43 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -48,18 +48,13 @@ writerBench doc (name, writer) = bench (name ++ " writer") $ nf
main :: IO ()
main = do
args <- getArgs
+ print args
let matchReader (n, TextReader _) =
- case args of
- [] -> True
- [x] -> x == n
- (x:y:_) -> x == n && y == "reader"
- matchReader (_, _) = False
+ "reader" `elem` args && n `elem` args
+ matchReader _ = False
let matchWriter (n, TextWriter _) =
- case args of
- [] -> True
- [x] -> x == n
- (x:y:_) -> x == n && y == "writer"
- matchWriter (_, _) = False
+ "writer" `elem` args && n `elem` args
+ matchWriter _ = False
let matchedReaders = filter matchReader readers
let matchedWriters = filter matchWriter writers
inp <- UTF8.toText <$> B.readFile "test/testsuite.txt"