aboutsummaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorBodigrim <andrew.lelechenko@gmail.com>2021-03-16 01:19:36 +0000
committerJohn MacFarlane <jgm@berkeley.edu>2021-03-15 18:50:21 -0700
commitd94f9b930ade715cd7a3d59a18017c52e75a7888 (patch)
tree3d411e68f283e2644594e3892dd42afb2c9c811a /benchmark
parent78775751d900c4b1a010c85a4026b11bf3ee4f68 (diff)
downloadpandoc-d94f9b930ade715cd7a3d59a18017c52e75a7888.tar.gz
Force readFile in benchmarks early
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/benchmark-pandoc.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index 1315166b9..a4e72f584 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -56,10 +56,10 @@ readerBench doc name = either (const Nothing) Just $
getImages :: IO [(FilePath, MimeType, BL.ByteString)]
getImages = do
- ll <- BL.readFile "test/lalune.jpg"
- mv <- BL.readFile "test/movie.jpg"
- return [("lalune.jpg", "image/jpg", ll)
- ,("movie.jpg", "image/jpg", mv)]
+ ll <- B.readFile "test/lalune.jpg"
+ mv <- B.readFile "test/movie.jpg"
+ return [("lalune.jpg", "image/jpg", BL.fromStrict ll)
+ ,("movie.jpg", "image/jpg", BL.fromStrict mv)]
writerBench :: [(FilePath, MimeType, BL.ByteString)]
-> Pandoc
@@ -91,9 +91,9 @@ main = do
inp <- UTF8.toText <$> B.readFile "test/testsuite.txt"
let opts = def
let doc = either (error . show) id $ runPure $ readMarkdown opts inp
- imgs <- getImages
defaultMain
- [ bgroup "writers" $ mapMaybe (writerBench imgs doc . fst)
+ [ env getImages $ \imgs ->
+ bgroup "writers" $ mapMaybe (writerBench imgs doc . fst)
(sortOn fst
writers :: [(T.Text, Writer PandocPure)])
, bgroup "readers" $ mapMaybe (readerBench doc . fst)