diff options
author | John MacFarlane <jgm@berkeley.edu> | 2021-03-15 22:50:18 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-03-15 22:50:18 -0700 |
commit | ff0fcedcb3c33015f9d550acce8fad2d662d49bd (patch) | |
tree | fee6dd7d5fc878e16f961ca082bf33c3186d02aa /benchmark | |
parent | d94f9b930ade715cd7a3d59a18017c52e75a7888 (diff) | |
download | pandoc-ff0fcedcb3c33015f9d550acce8fad2d662d49bd.tar.gz |
Switch to gauge for now for benchmarks.
tasty-bench is displaying odd behavior, with different
timings depending on the `--pattern` specified.
Diffstat (limited to 'benchmark')
-rw-r--r-- | benchmark/benchmark-pandoc.hs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/benchmark/benchmark-pandoc.hs b/benchmark/benchmark-pandoc.hs index a4e72f584..f9a872011 100644 --- a/benchmark/benchmark-pandoc.hs +++ b/benchmark/benchmark-pandoc.hs @@ -18,12 +18,12 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -} import Text.Pandoc import Text.Pandoc.MIME -import Control.Monad (when) +import Control.DeepSeq (force) import Control.Monad.Except (throwError) import qualified Text.Pandoc.UTF8 as UTF8 import qualified Data.ByteString as B import qualified Data.Text as T -import Test.Tasty.Bench +import Gauge import qualified Data.ByteString.Lazy as BL import Data.Maybe (mapMaybe) import Data.List (sortOn) @@ -31,10 +31,10 @@ import Data.List (sortOn) readerBench :: Pandoc -> T.Text -> Maybe Benchmark +readerBench _ name + | name `elem` ["bibtex", "biblatex", "csljson"] = Nothing readerBench doc name = either (const Nothing) Just $ runPure $ do - when (name `elem` ["bibtex", "biblatex", "csljson"]) $ - throwError $ PandocSomeError $ name <> " not supported for benchmark" (rdr, rexts) <- getReader name (wtr, wexts) <- getWriter name case (rdr, wtr) of @@ -65,10 +65,10 @@ writerBench :: [(FilePath, MimeType, BL.ByteString)] -> Pandoc -> T.Text -> Maybe Benchmark +writerBench _ _ name + | name `elem` ["bibtex", "biblatex", "csljson"] = Nothing writerBench imgs doc name = either (const Nothing) Just $ runPure $ do - when (name `elem` ["bibtex", "biblatex", "csljson"]) $ - throwError $ PandocSomeError $ name <> " not supported for benchmark" (wtr, wexts) <- getWriter name case wtr of TextWriter writerFun -> @@ -90,7 +90,7 @@ main :: IO () main = do inp <- UTF8.toText <$> B.readFile "test/testsuite.txt" let opts = def - let doc = either (error . show) id $ runPure $ readMarkdown opts inp + let doc = either (error . show) force $ runPure $ readMarkdown opts inp defaultMain [ env getImages $ \imgs -> bgroup "writers" $ mapMaybe (writerBench imgs doc . fst) |