@@ -0,0 +1,18 @@
1+module Sets (benchmarks) where
2+
3+import Criterion
4+import Data.Char (ord)
5+import qualified Data.Attoparsec.Text.FastSet as FastSet
6+import qualified Data.HashSet as HashSet
7+import qualified Data.IntSet as IntSet
8+
9+smallSet :: String
10+smallSet = ['a'..'z'] ++ ['A'..'Z'] ++ ['0'..'9']
11+
12+benchmarks :: Benchmark
13+benchmarks = bgroup "sets" [
14+ bench "Fast" $ whnf (FastSet.member '*') (FastSet.fromList smallSet)
15+ , bench "HashSet" $ whnf (HashSet.member '*') (HashSet.fromList smallSet)
16+ , bench "IntSet" $ whnf (IntSet.member (ord '*'))
17+ (IntSet.fromList (map ord smallSet))
18+ ]