Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
169dd81
Fix stream benchmark renaming in bench-runner
harendra-kumar Jun 12, 2026
09a093a
Remove nested bench groups in Data.Stream benchmarks
harendra-kumar Jun 12, 2026
8801977
Flatten Data.Stream benchmarks into single list per module
harendra-kumar Jun 13, 2026
ec8b558
Remove INLINE from IO action benchmarks in Data.Stream
harendra-kumar Jun 13, 2026
94fe450
Disable Unicode.Utf8 benchmark
harendra-kumar Jun 13, 2026
b4a8856
Flatten bgroup (bench groups) in all benchmarks
harendra-kumar Jun 13, 2026
559f91d
Flatten Array, StreamK benchmark lists into a single List
harendra-kumar Jun 14, 2026
8a84a3d
Move Unfold exception benchmarks from Stream to Unfold
harendra-kumar Jun 14, 2026
6c282f6
Move the pipe benchmarks to Data.Pipe bench-suite
harendra-kumar Jun 14, 2026
5c5cf7a
Move the Scan benchmarks from Stream to Data.Scan bench
harendra-kumar Jun 14, 2026
8623a33
Move the iterated benchmarks from Basic to Composed
harendra-kumar Jun 14, 2026
3234c59
Break Stream/Type benchmark file into smaller files
harendra-kumar Jun 14, 2026
1737060
Fix iterated/dropWhileFalse warning
harendra-kumar Jun 14, 2026
f1b1920
Remove additional heap requirement for Data.Stream benchmarks
harendra-kumar Jun 14, 2026
dd2b535
Break Stream.Nesting bench module into smaller parts
harendra-kumar Jun 14, 2026
8743665
Fix the "streamly" sdist build
harendra-kumar Jun 14, 2026
ca4a4dc
Merge Scanl.Window benchmark with "Scanl"
harendra-kumar Jun 14, 2026
f17bd02
Remove Fold.Window, move remaining benches to Scanl
harendra-kumar Jun 14, 2026
7b7288d
Change Scanl benchmark names after the ops
harendra-kumar Jun 15, 2026
105bf30
Remove deprecation warning suppression
harendra-kumar Jun 15, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .github/workflows/regression-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ jobs:
Data.Array.Generic
Data.Array.Stream
Data.Fold
Data.Fold.Window
Data.MutArray
Data.Parser
Data.ParserK
Expand All @@ -38,7 +37,6 @@ jobs:
Data.RingArray
Data.Scanl
Data.Scanl.Concurrent
Data.Scanl.Window
Data.Serialize
Data.Stream
Data.Stream.Concurrent
Expand Down
2 changes: 1 addition & 1 deletion .packcheck.ignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.circleci/config.yml
.ghci
.github/workflows/freebsd.yml
.github/workflows/haskell.yml
.github/workflows/regression-check.yml
.github/workflows/packdiff.yml
Expand All @@ -8,7 +9,6 @@
.hlint.ignore
.hlint.yaml
.packcheck.ignore
.cirrus.yml
appveyor.yml
benchmark/bench-runner/cabal.project
benchmark/bench-runner/flake.lock
Expand Down
41 changes: 11 additions & 30 deletions benchmark/Streamly/Benchmark/Data/Array.hs
Original file line number Diff line number Diff line change
Expand Up @@ -83,33 +83,6 @@ createOfLastMax value = withStream value (S.fold (IA.createOfLast (value + 1)))
-- Bench groups
-------------------------------------------------------------------------------

o_1_space_generation :: Int -> [Benchmark]
o_1_space_generation value =
[ bgroup
"generation"
[ benchIO "write . intFromTo" $ sourceIntFromToFromStream value
, benchIO "read" $ readInstance value
, benchIO "writeN . IsList.fromList" $ sourceIsList value
, benchIO "writeN . IsString.fromString" $ sourceIsString value
]
]

o_1_space_elimination :: Int -> [Benchmark]
o_1_space_elimination value =
[ bgroup "elimination"
[ benchIO "length . IsList.toList" $ toListLength value
, benchIO "createOfLast.1" $ createOfLast1 value
, benchIO "createOfLast.10" $ createOfLast10 value
]
]

o_n_heap_serial :: Int -> [Benchmark]
o_n_heap_serial value =
[ bgroup "elimination"
[ benchIO "createOfLast.Max" $ createOfLastMax value
]
]

moduleName :: String
moduleName = "Data.Array"

Expand All @@ -118,9 +91,17 @@ defStreamSize = defaultStreamSize

benchmarks :: Int -> [(SpaceComplexity, Benchmark)]
benchmarks size =
fmap (SpaceO_1,)
(o_1_space_generation size ++ o_1_space_elimination size)
++ fmap (HeapO_n,) (o_n_heap_serial size)
[ (SpaceO_1, benchIO "write . intFromTo" $ sourceIntFromToFromStream size)
, (SpaceO_1, benchIO "read" $ readInstance size)
, (SpaceO_1, benchIO "writeN . IsList.fromList" $ sourceIsList size)
, (SpaceO_1, benchIO "writeN . IsString.fromString" $ sourceIsString size)

, (SpaceO_1, benchIO "length . IsList.toList" $ toListLength size)
, (SpaceO_1, benchIO "createOfLast.1" $ createOfLast1 size)
, (SpaceO_1, benchIO "createOfLast.10" $ createOfLast10 size)

, (HeapO_n, benchIO "createOfLast.Max" $ createOfLastMax size)
]
++ commonBenchmarks size

main :: IO ()
Expand Down
83 changes: 25 additions & 58 deletions benchmark/Streamly/Benchmark/Data/Array/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -140,63 +140,30 @@ writeN value = withStream value (S.fold (A.createOf value))
-- Bench groups
-------------------------------------------------------------------------------

common_o_1_space_generation :: Int -> [Benchmark]
common_o_1_space_generation value =
[ bgroup
"generation"
[ benchIO "writeN . intFromTo" $ sourceIntFromTo value
, benchIO "fromList . intFromTo" $ sourceIntFromToFromList value
, benchIO "writeN . unfoldr" $ sourceUnfoldr value
, benchIO "writeN . fromList" $ sourceFromList value
, benchIO "show" $ showStream value
]
]

common_o_1_space_elimination :: Int -> [Benchmark]
common_o_1_space_elimination value =
[ bgroup "elimination"
[ benchIO "id" $ idArr value
, benchIO "==" $ eqInstance value
, benchIO "/=" $ eqInstanceNotEq value
, benchIO "<" $ ordInstance value
, benchIO "min" $ ordInstanceMin value
, benchIO "foldl'" $ pureFoldl' value
, benchIO "read" $ unfoldReadDrain value
, benchIO "toStreamRev" $ toStreamRevDrain value
]
]

common_o_n_heap_serial :: Int -> [Benchmark]
common_o_n_heap_serial value =
[ bgroup "elimination"
[ benchIO "writeN" $ writeN value
]
]

common_o_1_space_transformation :: Int -> [Benchmark]
common_o_1_space_transformation value =
[ bgroup "transformation"
[ benchIO "scanl'" $ scanl' value
, benchIO "scanl1'" $ scanl1' value
, benchIO "map" $ map value
]
]

common_o_1_space_transformationX4 :: Int -> [Benchmark]
common_o_1_space_transformationX4 value =
[ bgroup "transformationX4"
[ benchIO "scanl'" $ scanl'X4 value
, benchIO "scanl1'" $ scanl1'X4 value
, benchIO "map" $ mapX4 value
]
]

commonBenchmarks :: Int -> [(SpaceComplexity, Benchmark)]
commonBenchmarks size =
fmap (SpaceO_1,) (concat
[ common_o_1_space_generation size
, common_o_1_space_elimination size
, common_o_1_space_transformation size
, common_o_1_space_transformationX4 size
])
++ fmap (HeapO_n,) (common_o_n_heap_serial size)
[ (SpaceO_1, benchIO "writeN . intFromTo" $ sourceIntFromTo size)
, (SpaceO_1, benchIO "fromList . intFromTo" $ sourceIntFromToFromList size)
, (SpaceO_1, benchIO "writeN . unfoldr" $ sourceUnfoldr size)
, (SpaceO_1, benchIO "writeN . fromList" $ sourceFromList size)
, (SpaceO_1, benchIO "show" $ showStream size)

, (SpaceO_1, benchIO "id" $ idArr size)
, (SpaceO_1, benchIO "==" $ eqInstance size)
, (SpaceO_1, benchIO "/=" $ eqInstanceNotEq size)
, (SpaceO_1, benchIO "<" $ ordInstance size)
, (SpaceO_1, benchIO "min" $ ordInstanceMin size)
, (SpaceO_1, benchIO "foldl'" $ pureFoldl' size)
, (SpaceO_1, benchIO "unfoldRead" $ unfoldReadDrain size)
, (SpaceO_1, benchIO "toStreamRev" $ toStreamRevDrain size)

, (SpaceO_1, benchIO "scanl'" $ scanl' size)
, (SpaceO_1, benchIO "scanl1'" $ scanl1' size)
, (SpaceO_1, benchIO "map" $ map size)

, (SpaceO_1, benchIO "scanl'X4" $ scanl'X4 size)
, (SpaceO_1, benchIO "scanl1'X4" $ scanl1'X4 size)
, (SpaceO_1, benchIO "mapX4" $ mapX4 size)

, (HeapO_n, benchIO "writeN" $ writeN size)
]
35 changes: 8 additions & 27 deletions benchmark/Streamly/Benchmark/Data/Array/Generic.hs
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,6 @@ createOfLastMax value = withStream value (S.fold (IA.createOfLast (value + 1)))
-- Bench groups
-------------------------------------------------------------------------------

o_1_space_generation :: Int -> [Benchmark]
o_1_space_generation value =
[ bgroup
"generation"
[ benchIO "write . intFromTo" $ sourceIntFromToFromStream value
, benchIO "read" $ readInstance value
]
]

o_1_space_elimination :: Int -> [Benchmark]
o_1_space_elimination value =
[ bgroup "elimination"
[ benchIO "createOfLast.1" $ createOfLast1 value
, benchIO "createOfLast.10" $ createOfLast10 value
]
]

o_n_heap_serial :: Int -> [Benchmark]
o_n_heap_serial value =
[ bgroup "elimination"
[ benchIO "createOfLast.Max" $ createOfLastMax value
]
]

moduleName :: String
moduleName = "Data.Array.Generic"

Expand All @@ -103,9 +79,14 @@ defStreamSize = defaultStreamSize

benchmarks :: Int -> [(SpaceComplexity, Benchmark)]
benchmarks size =
fmap (SpaceO_1,)
(o_1_space_generation size ++ o_1_space_elimination size)
++ fmap (HeapO_n,) (o_n_heap_serial size)
[ (SpaceO_1, benchIO "write . intFromTo" $ sourceIntFromToFromStream size)
, (SpaceO_1, benchIO "read" $ readInstance size)

, (SpaceO_1, benchIO "createOfLast.1" $ createOfLast1 size)
, (SpaceO_1, benchIO "createOfLast.10" $ createOfLast10 size)

, (HeapO_n, benchIO "createOfLast.Max" $ createOfLastMax size)
]
++ commonBenchmarks size

main :: IO ()
Expand Down
14 changes: 3 additions & 11 deletions benchmark/Streamly/Benchmark/Data/Array/SmallArray.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{-# OPTIONS_GHC -Wno-deprecations #-}

{-# LANGUAGE CPP #-}

#include "Streamly/Benchmark/Data/Array/CommonImports.hs"
Expand Down Expand Up @@ -49,14 +47,6 @@ foldableSum = P.sum
-- Bench groups
-------------------------------------------------------------------------------

o_1_space_generation :: Int -> [Benchmark]
o_1_space_generation value =
[ bgroup
"generation"
[ benchIO "read" $ readInstance value
]
]

{-
o_1_space_elimination :: Int -> [Benchmark]
o_1_space_elimination value =
Expand All @@ -80,7 +70,9 @@ defStreamSize = 128

benchmarks :: Int -> [(SpaceComplexity, Benchmark)]
benchmarks size =
fmap (SpaceO_1,) (o_1_space_generation size) ++ commonBenchmarks size
[ (SpaceO_1, benchIO "read" $ readInstance size)
]
++ commonBenchmarks size

main :: IO ()
main = runWithCLIOpts defStreamSize allBenchmarks
Expand Down
89 changes: 37 additions & 52 deletions benchmark/Streamly/Benchmark/Data/Array/Stream.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,27 +157,6 @@ inspect $ hasNoTypeClasses 'toChunksSplitOn
inspect $ 'toChunksSplitOn `hasNoType` ''Step
#endif

o_1_space_read_chunked :: BenchEnv -> [Benchmark]
o_1_space_read_chunked env =
-- read using toChunks instead of read
[ bgroup "reduce/toChunks"
[ mkBench "Stream.last" env $ \inH _ ->
toChunksLast inH
-- Note: this cannot be fairly compared with GNU wc -c or wc -m as
-- wc uses lseek to just determine the file size rather than reading
-- and counting characters.
, mkBench "Stream.sum . Stream.map Array.length" env $ \inH _ ->
toChunksSumLengths inH
, mkBench "splitOnSuffix" env $ \inH _ ->
toChunksSplitOnSuffix inH
, mkBench "splitOn" env $ \inH _ ->
toChunksSplitOn inH
, mkBench "countBytes" env $ \inH _ ->
toChunksCountBytes inH
, mkBenchSmall "decodeUtf8Arrays" env $ \inH _ ->
toChunksDecodeUtf8Arrays inH
]
]

-------------------------------------------------------------------------------
-- copy with group/ungroup transformations
Expand Down Expand Up @@ -211,15 +190,6 @@ inspect $ hasNoTypeClassesExcept 'copyChunksSplitInterpose [''Unbox]
inspect $ 'copyChunksSplitInterpose `hasNoType` ''Step
#endif

o_1_space_copy_toChunks_group_ungroup :: BenchEnv -> [Benchmark]
o_1_space_copy_toChunks_group_ungroup env =
[ bgroup "copy/toChunks/group-ungroup"
[ mkBench "interposeSuffix . splitOnSuffix" env $ \inh outh ->
copyChunksSplitInterposeSuffix inh outh
, mkBenchSmall "interpose . splitOn" env $ \inh outh ->
copyChunksSplitInterpose inh outh
]
]

-------------------------------------------------------------------------------
-- Parsers
Expand Down Expand Up @@ -258,24 +228,6 @@ parseBreak s = do
(Left _, _) -> return ()
(Right _, s1) -> parseBreak s1

o_1_space_serial_array ::
Int -> [Array.Array Int] -> [Array.Array Int] -> [Benchmark]
o_1_space_serial_array bound arraysSmall arraysBig =
[ benchIO "fold (of 100)" (\_ -> Stream.fromList arraysSmall) fold
, benchIO "fold (single)" (\_ -> Stream.fromList arraysBig) fold
, benchIO
"foldBreak (recursive, small arrays)"
(\_ -> Stream.fromList arraysSmall)
(foldBreak . StreamK.fromStream)
, benchIO "parse (of 100)" (\_ -> Stream.fromList arraysSmall)
$ parse bound
, benchIO "parse (single)" (\_ -> Stream.fromList arraysBig)
$ parse bound
, benchIO
"parseBreak (recursive, small arrays)"
(\_ -> Stream.fromList arraysSmall)
(parseBreak . StreamK.fromStream)
]

-------------------------------------------------------------------------------
-- Driver
Expand All @@ -302,10 +254,43 @@ main = do

benchmarks env arrays value =
let (arraysSmall, arraysBig) = arrays
in map (SpaceO_1,) $ Prelude.concat
[ o_1_space_read_chunked env
, o_1_space_serial_array value arraysSmall arraysBig
, o_1_space_copy_toChunks_group_ungroup env
in
-- read using toChunks instead of read
[ (SpaceO_1, mkBench "Stream.last" env $ \inH _ ->
toChunksLast inH)
-- Note: this cannot be fairly compared with GNU wc -c or wc -m as
-- wc uses lseek to just determine the file size rather than reading
-- and counting characters.
, (SpaceO_1, mkBench "Stream.sum . Stream.map Array.length" env $ \inH _ ->
toChunksSumLengths inH)
, (SpaceO_1, mkBench "splitOnSuffix" env $ \inH _ ->
toChunksSplitOnSuffix inH)
, (SpaceO_1, mkBench "splitOn" env $ \inH _ ->
toChunksSplitOn inH)
, (SpaceO_1, mkBench "countBytes" env $ \inH _ ->
toChunksCountBytes inH)
, (SpaceO_1, mkBenchSmall "decodeUtf8Arrays" env $ \inH _ ->
toChunksDecodeUtf8Arrays inH)

, (SpaceO_1, benchIO "fold (of 100)" (\_ -> Stream.fromList arraysSmall) fold)
, (SpaceO_1, benchIO "fold (single)" (\_ -> Stream.fromList arraysBig) fold)
, (SpaceO_1, benchIO
"foldBreak (recursive, small arrays)"
(\_ -> Stream.fromList arraysSmall)
(foldBreak . StreamK.fromStream))
, (SpaceO_1, benchIO "parse (of 100)" (\_ -> Stream.fromList arraysSmall)
$ parse value)
, (SpaceO_1, benchIO "parse (single)" (\_ -> Stream.fromList arraysBig)
$ parse value)
, (SpaceO_1, benchIO
"parseBreak (recursive, small arrays)"
(\_ -> Stream.fromList arraysSmall)
(parseBreak . StreamK.fromStream))

, (SpaceO_1, mkBench "interposeSuffix . splitOnSuffix" env $ \inh outh ->
copyChunksSplitInterposeSuffix inh outh)
, (SpaceO_1, mkBenchSmall "interpose . splitOn" env $ \inh outh ->
copyChunksSplitInterpose inh outh)
]

allBenchmarks env arrays value =
Expand Down
Loading
Loading