Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
T
text
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Contributor analytics
CI/CD analytics
Repository 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
Packages
text
Commits
ba51a486
Commit
ba51a486
authored
4 years ago
by
Bodigrim
Committed by
Xia Li-yao
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix benchmarks on Windows: there is no /dev/null there
parent
af3ef85f
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
benchmarks/haskell/Benchmarks.hs
+29
-8
29 additions, 8 deletions
benchmarks/haskell/Benchmarks.hs
text.cabal
+1
-0
1 addition, 0 deletions
text.cabal
with
30 additions
and
8 deletions
benchmarks/haskell/Benchmarks.hs
+
29
−
8
View file @
ba51a486
-- | Main module to run the micro benchmarks
{-# LANGUAGE CPP #-}
--
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE OverloadedStrings #-}
module
Main
module
Main
(
main
(
main
)
where
)
where
import
Test.Tasty.Bench
(
defaultMain
,
bgroup
,
env
)
import
Test.Tasty.Bench
(
defaultMain
,
bgroup
,
env
)
import
System.FilePath
((
</>
))
import
System.FilePath
((
</>
))
import
System.IO
(
IOMode
(
WriteMode
),
openFile
,
hSetEncoding
,
utf8
)
import
System.IO
#
ifdef
mingw32_HOST_OS
import
System.Directory
(
removeFile
)
#
endif
import
qualified
Benchmarks.Builder
as
Builder
import
qualified
Benchmarks.Builder
as
Builder
import
qualified
Benchmarks.Concat
as
Concat
import
qualified
Benchmarks.Concat
as
Concat
...
@@ -32,10 +36,29 @@ import qualified Benchmarks.Programs.Sort as Programs.Sort
...
@@ -32,10 +36,29 @@ import qualified Benchmarks.Programs.Sort as Programs.Sort
import
qualified
Benchmarks.Programs.StripTags
as
Programs.StripTags
import
qualified
Benchmarks.Programs.StripTags
as
Programs.StripTags
import
qualified
Benchmarks.Programs.Throughput
as
Programs.Throughput
import
qualified
Benchmarks.Programs.Throughput
as
Programs.Throughput
mkSink
::
IO
(
FilePath
,
Handle
)
mkSink
=
do
#
ifdef
mingw32_HOST_OS
(
sinkFn
,
sink
)
<-
openTempFile
"."
"dev.null"
#
else
let
sinkFn
=
"/dev/null"
sink
<-
openFile
sinkFn
WriteMode
#
endif
hSetEncoding
sink
utf8
pure
(
sinkFn
,
sink
)
rmSink
::
FilePath
->
IO
()
#
ifdef
mingw32_HOST_OS
rmSink
=
removeFile
#
else
rmSink
_
=
pure
()
#
endif
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
sink
<-
openFile
"/dev/null"
WriteMode
let
tf
=
(
"benchmarks/text-test-data"
</>
)
hSetEncoding
sink
utf8
-- Cannot use envWithCleanup, because there is no instance NFData Handle
(
sinkFn
,
sink
)
<-
mkSink
defaultMain
defaultMain
[
Builder
.
benchmark
[
Builder
.
benchmark
,
Concat
.
benchmark
,
Concat
.
benchmark
...
@@ -78,6 +101,4 @@ main = do
...
@@ -78,6 +101,4 @@ main = do
,
Programs
.
Throughput
.
benchmark
(
tf
"russian.txt"
)
sink
,
Programs
.
Throughput
.
benchmark
(
tf
"russian.txt"
)
sink
]
]
]
]
where
rmSink
sinkFn
-- Location of a test file
tf
=
(
"benchmarks/text-test-data"
</>
)
This diff is collapsed.
Click to expand it.
text.cabal
+
1
−
0
View file @
ba51a486
...
@@ -226,6 +226,7 @@ benchmark text-benchmarks
...
@@ -226,6 +226,7 @@ benchmark text-benchmarks
bytestring >= 0.10.4,
bytestring >= 0.10.4,
containers,
containers,
deepseq,
deepseq,
directory,
filepath,
filepath,
tasty-bench >= 0.2,
tasty-bench >= 0.2,
text,
text,
...
...
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