on 73e7201 help sign in
64 lines 2.0 kB history raw
1{- | Specification of the benchmarks.
3This module keeps a list of all bencharks, this way
4we can group benchmark by the interesting function, not
5by the implementation.
6-}
7module Spec
8 ( BenchSpec(..)
9 ) where
11import Criterion (Benchmark)
14{- | List of benchmarks that each module should provide.
15If implementation can express the benchmark then it
16can return @Nothing@ in that benchmark.
18Map should contain elements from @1@ to @size of map@
19inserted in ascending order (later that requirement may
20change).
21-}
22data BenchSpec = BenchSpec
23 { {- | Basic lookup we look 10 values inside 10k map.
25 Implementation may look like:
27 @
28 tenLookups :: TypeRepMap (Proxy :: Nat -> *)
29 -> ( Proxy 10, Proxy 20, Proxy 30, Proxy 40
30 , Proxy 50, Proxy 60, Proxy 70, Proxy 80
31 )
32 tenLookups tmap = (lp, lp, lp, lp, lp, lp, lp, lp)
33 @
34 -}
35 benchLookup :: Maybe (String -> Benchmark)
36 {- ^ Insert 10 elements into an empty map.
38 Implementation may look like:
40 @
41 inserts
42 :: forall a . (KnownNat a)
43 => TypeRepMap (Proxy :: Nat -> *)
44 -> Int
45 -> Proxy (a :: Nat)
46 -> TypeRepMap (Proxy :: Nat -> *)
47 inserts !c 0 _ = c
48 inserts !c n x = inserts (insert x c) (n-1) (Proxy :: Proxy (a+1))
49 @
50 -}
51 , benchInsertSmall :: Maybe (String -> Benchmark)
52 {- ^ Insert 10 elements into a big map. Implementation is like
53 a small map, but should insert values into 10k elements map.
54 -}
55 , benchInsertBig :: Maybe (String -> Benchmark)
56 {- ^ Insert 10 elements into map of 10 elements, where each key
57 was already inserted in the map
58 -}
59 , benchUpdateSmall :: Maybe (String -> Benchmark)
60 {- ^ Insert 10 elements into map of 10k elements, where each key
61 was already inserted in the map
62 -}
63 , benchUpdateBig :: Maybe (String -> Benchmark)
64 }