packages feed

wordchoice-0.1.2.8: bench/Bench.hs

module Main (main) where

import           Criterion.Main
import           Data.Text.Lazy      (fromStrict)
import           Data.Text.WordCount
import           Text.Pandoc

main :: IO ()
main = do
    defaultMain [ env ulysses $ \file ->
                  bgroup "ulysses all"
                      [ bench "226" $ nf (fun 10000000) file ]
                , env beowulf $ \file ->
                  bgroup "beowulf all"
                      [ bench "226" $ nf (fun 10000000) file ] ]
    where fun n   = topN n . fromStrict
          ulysses = runIOorExplode $ processFile "test/data/ulysses.txt"
          beowulf = runIOorExplode $ processFile "test/data/beowulf.txt"