aboutsummaryrefslogtreecommitdiff
path: root/benchmark
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2017-06-10 23:39:49 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2017-06-11 00:46:31 +0200
commitfa719d026464619dd51714620470998ab5d18e17 (patch)
tree9eb4eeaff01a2c6f3ccb283ff57d07ef5f622beb /benchmark
parent0c2a509dfb3bd9f7ba8a0fdec02a165ed7cf49da (diff)
downloadpandoc-fa719d026464619dd51714620470998ab5d18e17.tar.gz
Switched Writer types to use Text.
* XML.toEntities: changed type to Text -> Text. * Shared.tabFilter -- fixed so it strips out CRs as before. * Modified writers to take Text. * Updated tests, benchmarks, trypandoc. [API change] Closes #3731.
Diffstat (limited to 'benchmark')
-rw-r--r--benchmark/benchmark-pandoc.hs10
-rw-r--r--benchmark/weigh-pandoc.hs8
2 files changed, 9 insertions, 9 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs
index be44c462f..fc1df1e9c 100644
--- a/benchmark/benchmark-pandoc.hs
+++ b/benchmark/benchmark-pandoc.hs
@@ -33,15 +33,15 @@ readerBench :: Pandoc
-> Maybe Benchmark
readerBench doc (name, reader) =
case lookup name writers of
- Just (StringWriter writer) ->
- let inp = either (error . show) pack $ runPure
+ Just (TextWriter writer) ->
+ let inp = either (error . show) id $ runPure
$ writer def{ writerWrapText = WrapAuto} doc
in return $ bench (name ++ " reader") $ nf
(reader def) inp
_ -> trace ("\nCould not find writer for " ++ name ++ "\n") Nothing
writerBench :: Pandoc
- -> (String, WriterOptions -> Pandoc -> String)
+ -> (String, WriterOptions -> Pandoc -> Text)
-> Benchmark
writerBench doc (name, writer) = bench (name ++ " writer") $ nf
(writer def{ writerWrapText = WrapAuto }) doc
@@ -55,7 +55,7 @@ main = do
[x] -> x == n
(x:y:_) -> x == n && y == "reader"
matchReader (_, _) = False
- let matchWriter (n, StringWriter _) =
+ let matchWriter (n, TextWriter _) =
case args of
[] -> True
[x] -> x == n
@@ -81,7 +81,7 @@ main = do
$ filter (\(n,_) -> n /="haddock") readers'
let writers' = [(n, \o d ->
either (error . show) id $ runPure $ setupFakeFiles >> w o d)
- | (n, StringWriter w) <- matchedWriters]
+ | (n, TextWriter w) <- matchedWriters]
let writerBs = map (writerBench doc)
$ writers'
defaultMainWith defaultConfig{ timeLimit = 6.0 }
diff --git a/benchmark/weigh-pandoc.hs b/benchmark/weigh-pandoc.hs
index 35296f925..d3cada8c0 100644
--- a/benchmark/weigh-pandoc.hs
+++ b/benchmark/weigh-pandoc.hs
@@ -1,6 +1,6 @@
import Weigh
import Text.Pandoc
-import Data.Text (Text, pack)
+import Data.Text (Text)
main :: IO ()
main = do
@@ -24,14 +24,14 @@ main = do
,("commonmark", writeCommonMark)
]
-weighWriter :: Pandoc -> String -> (Pandoc -> String) -> Weigh ()
+weighWriter :: Pandoc -> String -> (Pandoc -> Text) -> Weigh ()
weighWriter doc name writer = func (name ++ " writer") writer doc
weighReader :: Pandoc -> String -> (Text -> Pandoc) -> Weigh ()
weighReader doc name reader = do
case lookup name writers of
- Just (StringWriter writer) ->
- let inp = either (error . show) pack $ runPure $ writer def{ writerWrapText = WrapAuto} doc
+ Just (TextWriter writer) ->
+ let inp = either (error . show) id $ runPure $ writer def{ writerWrapText = WrapAuto} doc
in func (name ++ " reader") reader inp
_ -> return () -- no writer for reader