Skip to content

Commit

Permalink
initial benchmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
bartavelle committed Feb 8, 2018
1 parent 03d8fb4 commit ce8d1b0
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions 7startups.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,14 @@ library
-- hs-source-dirs:
default-language: Haskell2010

Benchmark multiset
hs-source-dirs: bench
type: exitcode-stdio-1.0
ghc-options: -Wall
build-depends: 7startups, base, multiset, criterion
main-is: multiset.hs
default-language: Haskell2010

Test-Suite tests
hs-source-dirs: tests
type: exitcode-stdio-1.0
Expand Down
25 changes: 25 additions & 0 deletions bench/multiset.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
module Main where

import Startups.Base

import Criterion
import Criterion.Main

import qualified Data.MultiSet as MS
import qualified RMultiSet as RS

smallList :: [Resource]
smallList = [Hype, Operations]

largeList :: [Resource]
largeList = concat (replicate 100 [minBound .. maxBound])

main :: IO ()
main = defaultMain
[ bgroup "fromList"
[ bench "multiset - small" $ whnf MS.fromList smallList
, bench "resource - small" $ whnf RS.fromList smallList
, bench "multiset - large" $ whnf MS.fromList largeList
, bench "resource - large" $ whnf RS.fromList largeList
]
]

0 comments on commit ce8d1b0

Please sign in to comment.