2Copyright (C) 2012-2014 John MacFarlane <jgm@berkeley.edu>
4This program is free software; you can redistribute it and/or modify
5it under the terms of the GNU General Public License as published by
6the Free Software Foundation; either version 2 of the License, or
7(at your option) any later version.
9This program is distributed in the hope that it will be useful,
10but WITHOUT ANY WARRANTY; without even the implied warranty of
11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12GNU General Public License for more details.
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20import Criterion.Config
21import System.Environment (getArgs)
23import Data.Maybe (mapMaybe)
24import Debug.Trace (trace)
25import Text.Pandoc.Error
26import Control.Applicative
29 -> (String, ReaderOptions -> String -> IO (Either PandocError Pandoc))
31readerBench doc (name, reader) =
32 case lookup name writers of
33 Just (PureStringWriter writer) ->
34 let inp = writer def{ writerWrapText = True} doc
35 in return $ bench (name ++ " reader") $ nfIO $
36 (fmap handleError <$> reader def{ readerSmart = True }) inp
37 _ -> trace ("\nCould not find writer for " ++ name ++ "\n") Nothing
40 -> (String, WriterOptions -> Pandoc -> String)
42writerBench doc (name, writer) = bench (name ++ " writer") $ nf
43 (writer def{ writerWrapText = True }) doc
48 (conf,_) <- parseArgs defaultConfig{ cfgSamples = Last $ Just 20 }
50 inp <- readFile "tests/testsuite.txt"
51 let opts = def{ readerSmart = True }
52 let doc = handleError $ readMarkdown opts inp
53 let readers' = [(n,r) | (n, StringReader r) <- readers]
54 let readerBs = mapMaybe (readerBench doc)
55 $ filter (\(n,_) -> n /="haddock") readers'
56 let writers' = [(n,w) | (n, PureStringWriter w) <- writers]
57 let writerBs = map (writerBench doc)
59 defaultMainWith conf (return ()) $
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list