File: BenchmarkTypes.hs

package info (click to toggle)
haskell-psqueues 0.2.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 240 kB
  • sloc: haskell: 2,651; makefile: 2
file content (28 lines) | stat: -rw-r--r-- 940 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

module BenchmarkTypes where

import Criterion

type BElem = (Int, Int, ())

data BenchmarkSet = BenchmarkSet
    { bGroupName        :: String
    , bMinView          :: Benchmarkable
    , bLookup           :: Benchmarkable
    , bInsertEmpty      :: Benchmarkable
    , bInsertNew        :: Benchmarkable
    , bInsertDuplicates :: Benchmarkable
    , bDelete           :: Benchmarkable
    }

runBenchmark :: [BenchmarkSet] -> [Benchmark]
runBenchmark bset =
    [ bgroup "minView"          $ map (bench' bMinView)          bset
    , bgroup "lookup"           $ map (bench' bLookup)           bset
    , bgroup "insertEmpty"      $ map (bench' bInsertEmpty)      bset
    , bgroup "insertNew"        $ map (bench' bInsertNew)        bset
    , bgroup "insertDuplicates" $ map (bench' bInsertDuplicates) bset
    , bgroup "delete"           $ map (bench' bDelete)           bset
    ]
  where
   bench' f x = bench (bGroupName x) (f x)