Integrated benchmark into cabal.
Can now do: cabal configure --enable-benchmarks && cabal build cabal bench --benchmark-option='markdown' --benchmark-option='-s 20'
This commit is contained in:
parent
45e4c123a4
commit
c414a08bcf
2 changed files with 21 additions and 4 deletions
|
@ -3,7 +3,6 @@ import Text.Pandoc.Shared (readDataFile, normalize)
|
||||||
import Criterion.Main
|
import Criterion.Main
|
||||||
import Data.List (isSuffixOf)
|
import Data.List (isSuffixOf)
|
||||||
import Text.JSON.Generic
|
import Text.JSON.Generic
|
||||||
import Data.Default
|
|
||||||
|
|
||||||
readerBench :: Pandoc
|
readerBench :: Pandoc
|
||||||
-> (String, ReaderOptions -> String -> Pandoc)
|
-> (String, ReaderOptions -> String -> Pandoc)
|
||||||
|
@ -42,5 +41,6 @@ main = do
|
||||||
let doc = readMarkdown opts inp
|
let doc = readMarkdown opts inp
|
||||||
let readerBs = map (readerBench doc) readers
|
let readerBs = map (readerBench doc) readers
|
||||||
let writers' = [(n,w) | (n, PureStringWriter w) <- writers]
|
let writers' = [(n,w) | (n, PureStringWriter w) <- writers]
|
||||||
defaultMain $ map (writerBench doc) writers' ++ readerBs ++ normalizeBench doc
|
defaultMain $
|
||||||
|
map (writerBench doc) writers' ++ readerBs ++ normalizeBench doc
|
||||||
|
|
21
pandoc.cabal
21
pandoc.cabal
|
@ -96,8 +96,6 @@ Extra-Source-Files:
|
||||||
-- generated man pages (produced post-build)
|
-- generated man pages (produced post-build)
|
||||||
man/man1/pandoc.1,
|
man/man1/pandoc.1,
|
||||||
man/man5/pandoc_markdown.5,
|
man/man5/pandoc_markdown.5,
|
||||||
-- benchmarks
|
|
||||||
Benchmark.hs,
|
|
||||||
-- tests
|
-- tests
|
||||||
tests/bodybg.gif,
|
tests/bodybg.gif,
|
||||||
tests/docbook-reader.docbook
|
tests/docbook-reader.docbook
|
||||||
|
@ -427,3 +425,22 @@ Executable test-pandoc
|
||||||
Default-Language: Haskell98
|
Default-Language: Haskell98
|
||||||
Default-Extensions: CPP, TemplateHaskell, QuasiQuotes
|
Default-Extensions: CPP, TemplateHaskell, QuasiQuotes
|
||||||
|
|
||||||
|
benchmark benchmark-pandoc
|
||||||
|
Type: exitcode-stdio-1.0
|
||||||
|
Main-Is: benchmark-pandoc.hs
|
||||||
|
Hs-Source-Dirs: benchmark
|
||||||
|
if impl(ghc >= 6.10)
|
||||||
|
Build-depends: base >= 4 && < 5, syb >= 0.1 && < 0.4
|
||||||
|
else
|
||||||
|
Build-depends: base >= 3 && < 4
|
||||||
|
Build-Depends: pandoc,
|
||||||
|
criterion >= 0.5 && < 0.7,
|
||||||
|
json >= 0.4 && < 0.6
|
||||||
|
if impl(ghc >= 7.0.1)
|
||||||
|
Ghc-Options: -O2 -rtsopts -Wall -fno-warn-unused-do-bind -dno-debug-output
|
||||||
|
else
|
||||||
|
if impl(ghc >= 6.12)
|
||||||
|
Ghc-Options: -O2 -Wall -fno-warn-unused-do-bind -dno-debug-output
|
||||||
|
else
|
||||||
|
Ghc-Options: -O2 -Wall
|
||||||
|
Default-Language: Haskell98
|
||||||
|
|
Loading…
Reference in a new issue