benchmarks
This commit is contained in:
parent
1372c2470e
commit
48d94fee6d
4 changed files with 29 additions and 6 deletions
5
.dir-locals.el
Normal file
5
.dir-locals.el
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
;;; Directory Local Variables
|
||||||
|
;;; For more information see (info "(emacs) Directory Variables")
|
||||||
|
|
||||||
|
((haskell-mode
|
||||||
|
(intero-targets "human-friendly-id-gen:lib" "human-friendly-id-gen:exe:hfig" "human-friendly-id-gen:test:human-friendly-id-gen-doctest" "human-friendly-id-gen:test:human-friendly-id-gen-test" "human-friendly-id-gen:bench:human-friendly-id-gen-benchmark")))
|
|
@ -2,7 +2,7 @@
|
||||||
--
|
--
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
--
|
--
|
||||||
-- hash: 0e683ac9d8dfb5f4d7ce10cbfd8e10b825fae281ba0c99bb21798b3482443854
|
-- hash: 5be2664cdea2186d72a0e88938c79a9c59698ad4464b107909e4add64ff85b0c
|
||||||
|
|
||||||
name: human-friendly-id-gen
|
name: human-friendly-id-gen
|
||||||
version: 0.1.0.0
|
version: 0.1.0.0
|
||||||
|
@ -113,4 +113,5 @@ benchmark human-friendly-id-gen-benchmark
|
||||||
, criterion >=1.1
|
, criterion >=1.1
|
||||||
, human-friendly-id-gen
|
, human-friendly-id-gen
|
||||||
, protolude
|
, protolude
|
||||||
|
, vector
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
|
|
|
@ -82,5 +82,6 @@ benchmarks:
|
||||||
- -with-rtsopts=-N
|
- -with-rtsopts=-N
|
||||||
dependencies:
|
dependencies:
|
||||||
- criterion >=1.1
|
- criterion >=1.1
|
||||||
|
- vector
|
||||||
- human-friendly-id-gen
|
- human-friendly-id-gen
|
||||||
stability: alpha (experimental)
|
stability: alpha (experimental)
|
||||||
|
|
|
@ -2,8 +2,24 @@ import Protolude
|
||||||
|
|
||||||
import Criterion
|
import Criterion
|
||||||
import Criterion.Main
|
import Criterion.Main
|
||||||
|
import qualified Data.Vector as V
|
||||||
|
|
||||||
import Lib (inc)
|
import qualified HFIG.Dictionary as Dict
|
||||||
|
import qualified HFIG.Lovecraftian as Lov
|
||||||
|
import qualified HFIG.Short as Short
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main = defaultMain [bench "inc 41" (whnf inc (41 :: Int))]
|
main = do
|
||||||
|
englishDict <- Dict.dictionaryFromFile "dictionaries/english.txt"
|
||||||
|
putText $ "loaded english Dict: " <> (show (V.length englishDict) :: Text)
|
||||||
|
genericDict <- Dict.dictionaryFromFile "dictionaries/generic.txt"
|
||||||
|
putText $ "loaded generic Dict: " <> (show (V.length genericDict) :: Text)
|
||||||
|
defaultMain [ bench "short idgen (10)" (nfIO (Short.idgen 10))
|
||||||
|
, bench "short idgen (100)" (nfIO (Short.idgen 100))
|
||||||
|
, bench "lovecraftian idgen (1)" (nfIO (Lov.idgen 1))
|
||||||
|
, bench "lovecraftian idgen (10)" (nfIO (Lov.idgen 10))
|
||||||
|
, bench "dictionary idgen (english 3)"
|
||||||
|
(nfIO (Dict.idgen englishDict 3))
|
||||||
|
, bench "dictionary idgen (generic 3)"
|
||||||
|
(nfIO (Dict.idgen genericDict 3))
|
||||||
|
]
|
||||||
|
|
Loading…
Reference in a new issue