Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CoPaR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Informatik 8
CoPaR
Commits
c3cca39c
Commit
c3cca39c
authored
Dec 22, 2018
by
Hans-Peter Deifel
Browse files
Options
Downloads
Patches
Plain Diff
Add benchmarks for BlockQueue
parent
a91392d6
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
bench/BenchMain.hs
+2
-0
2 additions, 0 deletions
bench/BenchMain.hs
bench/Data/BenchBlockQueue.hs
+79
-0
79 additions, 0 deletions
bench/Data/BenchBlockQueue.hs
copar.cabal
+1
-0
1 addition, 0 deletions
copar.cabal
with
82 additions
and
0 deletions
bench/BenchMain.hs
+
2
−
0
View file @
c3cca39c
...
@@ -8,6 +8,7 @@ import qualified Copar.Parser.BenchLexer
...
@@ -8,6 +8,7 @@ import qualified Copar.Parser.BenchLexer
import
qualified
Data.List.BenchUtils
import
qualified
Data.List.BenchUtils
import
qualified
Copar.Algorithm.BenchInitialize
import
qualified
Copar.Algorithm.BenchInitialize
import
qualified
Data.BenchRefinablePartition
import
qualified
Data.BenchRefinablePartition
import
qualified
Data.BenchBlockQueue
main
::
IO
()
main
::
IO
()
main
=
defaultMain
main
=
defaultMain
...
@@ -17,4 +18,5 @@ main = defaultMain
...
@@ -17,4 +18,5 @@ main = defaultMain
,
Data
.
List
.
BenchUtils
.
benchmarks
,
Data
.
List
.
BenchUtils
.
benchmarks
,
Copar
.
Algorithm
.
BenchInitialize
.
benchmarks
,
Copar
.
Algorithm
.
BenchInitialize
.
benchmarks
,
Data
.
BenchRefinablePartition
.
benchmarks
,
Data
.
BenchRefinablePartition
.
benchmarks
,
Data
.
BenchBlockQueue
.
benchmarks
]
]
This diff is collapsed.
Click to expand it.
bench/Data/BenchBlockQueue.hs
0 → 100644
+
79
−
0
View file @
c3cca39c
{-# LANGUAGE FlexibleInstances #-}
{-# OPTIONS_GHC -Wno-orphans #-}
module
Data.BenchBlockQueue
(
benchmarks
)
where
import
Prelude
hiding
(
elem
)
import
Criterion
import
Control.Monad.ST
import
Control.Monad
import
Control.DeepSeq
import
Data.BlockQueue
import
Data.Partition.Common
(
Block
(
..
)
)
benchmarks
::
Benchmark
benchmarks
=
bgroup
"Data.BlockQueue"
[
benchEnqueue
,
benchDequeue
,
benchElem
]
benchEnqueue
::
Benchmark
benchEnqueue
=
bgroup
"enqueue"
[
bench
"10 blocks"
$
withInit
(
empty
100
)
(
\
q
->
mapM_
(
enqueue
q
.
Block
)
[
0
..
9
])
,
bench
"20 blocks"
$
withInit
(
empty
100
)
(
\
q
->
mapM_
(
enqueue
q
.
Block
)
[
0
..
19
])
,
bench
"30 blocks"
$
withInit
(
empty
100
)
(
\
q
->
mapM_
(
enqueue
q
.
Block
)
[
0
..
29
])
,
bench
"100 blocks"
$
withInit
(
empty
1000
)
(
\
q
->
mapM_
(
enqueue
q
.
Block
)
[
0
..
99
])
,
bench
"200 blocks"
$
withInit
(
empty
1000
)
(
\
q
->
mapM_
(
enqueue
q
.
Block
)
[
0
..
199
])
,
bench
"300 blocks"
$
withInit
(
empty
1000
)
(
\
q
->
mapM_
(
enqueue
q
.
Block
)
[
0
..
299
])
]
benchDequeue
::
Benchmark
benchDequeue
=
bgroup
"dequeue"
[
bench
"10 blocks"
$
withInit
(
create
10
)
(
replicateM
10
.
dequeue
)
,
bench
"20 blocks"
$
withInit
(
create
20
)
(
replicateM
20
.
dequeue
)
,
bench
"30 blocks"
$
withInit
(
create
30
)
(
replicateM
30
.
dequeue
)
,
bench
"100 blocks"
$
withInit
(
create
100
)
(
replicateM
100
.
dequeue
)
,
bench
"200 blocks"
$
withInit
(
create
200
)
(
replicateM
200
.
dequeue
)
,
bench
"300 blocks"
$
withInit
(
create
300
)
(
replicateM
300
.
dequeue
)
]
benchElem
::
Benchmark
benchElem
=
bgroup
"elem"
[
mkBench
10
,
mkBench
20
,
mkBench
30
,
mkBench
100
,
mkBench
200
,
mkBench
300
]
where
mkBench
n
=
bench
(
show
n
++
" blocks"
)
$
withInit
(
create
n
)
(
\
q
->
mapM_
(`
elem
`
q
)
[
Block
i
|
i
<-
[
0
..
n
-
1
]])
instance
NFData
(
BlockQueue
RealWorld
)
where
rnf
p
=
seq
p
()
create
::
Int
->
ST
s
(
BlockQueue
s
)
create
n
=
do
q
<-
empty
n
mapM_
(
enqueue
q
.
Block
)
[
0
..
n
-
1
]
return
q
withInit
::
NFData
a
=>
ST
RealWorld
(
BlockQueue
RealWorld
)
->
(
BlockQueue
RealWorld
->
ST
RealWorld
a
)
->
Benchmarkable
withInit
initialize
action
=
perRunEnv
(
stToIO
initialize
)
(
stToIO
.
action
)
This diff is collapsed.
Click to expand it.
copar.cabal
+
1
−
0
View file @
c3cca39c
...
@@ -209,6 +209,7 @@ benchmark bench
...
@@ -209,6 +209,7 @@ benchmark bench
, Data.List.BenchUtils
, Data.List.BenchUtils
, Copar.Algorithm.BenchInitialize
, Copar.Algorithm.BenchInitialize
, Data.BenchRefinablePartition
, Data.BenchRefinablePartition
, Data.BenchBlockQueue
default-extensions: GADTs
default-extensions: GADTs
, StandaloneDeriving
, StandaloneDeriving
, DeriveFunctor
, DeriveFunctor
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
sign in
to comment