git.iko.soy/typeable/attoparsec
on master help sign in
21 lines 724 B history raw
1module Sets (benchmarks) where
3import Criterion
4import Data.Char (ord)
5import qualified Data.Attoparsec.Text.FastSet as FastSet
6import qualified TextFastSet
7import qualified Data.HashSet as HashSet
8import qualified Data.IntSet as IntSet
10smallSet :: String
11smallSet = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9']
13benchmarks :: Benchmark
14benchmarks = bgroup "sets" [
15 bench "Fast" $ whnf (FastSet.member '*') (FastSet.fromList smallSet)
16 , bench "Hash" $ whnf (HashSet.member '*') (HashSet.fromList smallSet)
17 , bench "Int" $ whnf (IntSet.member (ord '*'))
18 (IntSet.fromList (map ord smallSet))
19 , bench "TextFast" $ whnf (TextFastSet.member '*')
20 (TextFastSet.fromList smallSet)
21 ]