Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
N
nofib
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Glasgow Haskell Compiler
nofib
Commits
1bc24281
Commit
1bc24281
authored
14 years ago
by
Simon Marlow
Browse files
Options
Downloads
Patches
Plain Diff
add chan, a simple Chan performance benchmark
parent
d665bb10
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
smp/Makefile
+2
-1
2 additions, 1 deletion
smp/Makefile
smp/chan/Makefile
+8
-0
8 additions, 0 deletions
smp/chan/Makefile
smp/chan/chan.hs
+21
-0
21 additions, 0 deletions
smp/chan/chan.hs
with
31 additions
and
1 deletion
smp/Makefile
+
2
−
1
View file @
1bc24281
...
...
@@ -8,7 +8,8 @@ SUBDIRS = \
threads001
\
threads003
\
threads006
\
threads007
threads007
\
chan
# later:
# stm001
...
...
This diff is collapsed.
Click to expand it.
smp/chan/Makefile
0 → 100644
+
8
−
0
View file @
1bc24281
TOP
=
../..
include
$(TOP)/mk/boilerplate.mk
FAST_OPTS
=
100000
NORM_OPTS
=
5000000
SLOW_OPTS
=
50000000
include
$(TOP)/mk/target.mk
This diff is collapsed.
Click to expand it.
smp/chan/chan.hs
0 → 100644
+
21
−
0
View file @
1bc24281
-- benchmarks communication on Chan
--
-- This is a synthetic benchmark that is sensitive to scheduler
-- behaviour. In GHC 6.12 and earlier we triggered a context switch
-- shortly after waking up a thread, whereas in 6.14 and later we
-- stopped doing that. This benchmark performs worse with 6.14
-- becauuse not doing the context switch allows a lot of data to build
-- up in the Chan, making GC expensive.
import
Control.Concurrent
import
Control.Concurrent.Chan
import
System.Environment
import
Control.Monad
main
=
do
[
n
]
<-
fmap
(
fmap
read
)
getArgs
c
<-
newChan
m
<-
newEmptyMVar
a
<-
forkIO
$
forM_
[
1
..
n
]
$
\
i
->
writeChan
c
i
b
<-
forkIO
$
do
forM_
[
1
..
n
]
$
\
i
->
readChan
c
;
putMVar
m
()
takeMVar
m
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
register
or
sign in
to comment