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
6aa834a7
Commit
6aa834a7
authored
13 years ago
by
Jasper Van der Jeugt
Browse files
Options
Downloads
Patches
Plain Diff
Add Streaming benchmarks
parent
3845ffd4
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
tests/benchmarks/src/Data/Text/Benchmarks.hs
+2
-0
2 additions, 0 deletions
tests/benchmarks/src/Data/Text/Benchmarks.hs
tests/benchmarks/src/Data/Text/Benchmarks/Stream.hs
+43
-0
43 additions, 0 deletions
tests/benchmarks/src/Data/Text/Benchmarks/Stream.hs
with
45 additions
and
0 deletions
tests/benchmarks/src/Data/Text/Benchmarks.hs
+
2
−
0
View file @
6aa834a7
...
@@ -19,6 +19,7 @@ import qualified Data.Text.Benchmarks.Pure as Pure
...
@@ -19,6 +19,7 @@ import qualified Data.Text.Benchmarks.Pure as Pure
import
qualified
Data.Text.Benchmarks.ReadNumbers
as
ReadNumbers
import
qualified
Data.Text.Benchmarks.ReadNumbers
as
ReadNumbers
import
qualified
Data.Text.Benchmarks.Replace
as
Replace
import
qualified
Data.Text.Benchmarks.Replace
as
Replace
import
qualified
Data.Text.Benchmarks.Search
as
Search
import
qualified
Data.Text.Benchmarks.Search
as
Search
import
qualified
Data.Text.Benchmarks.Stream
as
Stream
import
qualified
Data.Text.Benchmarks.WordFrequencies
as
WordFrequencies
import
qualified
Data.Text.Benchmarks.WordFrequencies
as
WordFrequencies
import
qualified
Data.Text.Benchmarks.Programs.BigTable
as
Programs.BigTable
import
qualified
Data.Text.Benchmarks.Programs.BigTable
as
Programs.BigTable
...
@@ -52,6 +53,7 @@ benchmarks = do
...
@@ -52,6 +53,7 @@ benchmarks = do
,
ReadNumbers
.
benchmark
(
tf
"numbers.txt"
)
,
ReadNumbers
.
benchmark
(
tf
"numbers.txt"
)
,
Replace
.
benchmark
(
tf
"russian.txt"
)
"принимая"
"своем"
,
Replace
.
benchmark
(
tf
"russian.txt"
)
"принимая"
"своем"
,
Search
.
benchmark
(
tf
"russian.txt"
)
"принимая"
,
Search
.
benchmark
(
tf
"russian.txt"
)
"принимая"
,
Stream
.
benchmark
(
tf
"russian.txt"
)
,
WordFrequencies
.
benchmark
(
tf
"russian.txt"
)
,
WordFrequencies
.
benchmark
(
tf
"russian.txt"
)
]
]
...
...
This diff is collapsed.
Click to expand it.
tests/benchmarks/src/Data/Text/Benchmarks/Stream.hs
0 → 100644
+
43
−
0
View file @
6aa834a7
-- | This module contains a number of benchmarks for the different streaming
-- functions
--
-- Tested in this benchmark:
--
-- * Most streaming functions
--
{-# LANGUAGE BangPatterns #-}
{-# OPTIONS_GHC -fno-warn-orphans #-}
module
Data.Text.Benchmarks.Stream
(
benchmark
)
where
import
Control.DeepSeq
(
NFData
(
..
))
import
Criterion
(
Benchmark
,
bgroup
,
bench
,
nf
)
import
Data.Text.Fusion.Internal
(
Step
(
..
),
Stream
(
..
))
import
qualified
Data.ByteString
as
B
import
qualified
Data.ByteString.Lazy
as
BL
import
qualified
Data.Text.Encoding.Error
as
E
import
qualified
Data.Text.Encoding.Fusion
as
T
import
qualified
Data.Text.Lazy.Encoding.Fusion
as
TL
instance
NFData
a
=>
NFData
(
Stream
a
)
where
-- Currently, this implementation does not force evaluation of the size hint
rnf
(
Stream
next
s0
_
)
=
go
s0
where
go
!
s
=
case
next
s
of
Done
->
()
Skip
s'
->
go
s'
Yield
x
s'
->
rnf
x
`
seq
`
go
s'
benchmark
::
FilePath
->
IO
Benchmark
benchmark
fp
=
do
-- Load data
bs
<-
B
.
readFile
fp
lbs
<-
BL
.
readFile
fp
return
$
bgroup
"Stream"
[
bgroup
"streamUtf8"
[
bench
"Text"
$
nf
(
T
.
streamUtf8
E
.
lenientDecode
)
bs
,
bench
"LazyText"
$
nf
(
TL
.
streamUtf8
E
.
lenientDecode
)
lbs
]
]
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