@@ -27,7 +27,7 @@ import qualified Streamly.Prelude as S
2727
2828import Gauge
2929import Streamly.Benchmark.Common
30−import Prelude hiding (all, any, take, unzip)
30+import Prelude hiding (all, any, take, unzip, sequence_)
3131
3232-- We need a monadic bind here to make sure that the function f does not get
3333-- completely optimized out by the compiler in some cases.
@@ -68,6 +68,15 @@ all value = IP.fold (FL.all (<= value))
6868takeLE :: Monad m => Int -> SerialT m a -> m ()
6969takeLE value = IP.fold (FL.takeLE value FL.drain)
7070
71+{-# INLINE sequence_ #-}
72+sequence_ :: Monad m => Int -> Fold m a ()
73+sequence_ value = foldr f (pure ()) (Prelude.replicate value (FL.takeLE 1 FL.drain))
74+
75+ where
76+
77+ {-# INLINE f #-}
78+ f m k = FL.concatMap (const k) m
79+
7180-------------------------------------------------------------------------------
7281-- Splitting by serial application
7382-------------------------------------------------------------------------------
@@ -284,6 +293,11 @@ o_1_space_serial_composition value =
284293
285294 mp = Map.fromList [(0, FL.sum), (1, FL.length)]
286295
296+o_n_space_serial :: Int -> [Benchmark]
297+o_n_space_serial value =
298+ [ benchIOSink value "sequence_/100" $ S.fold (sequence_ (value `div` 100))
299+ ]
300+
287301o_n_heap_serial :: Int -> [Benchmark]
288302o_n_heap_serial value =
289303 [ bgroup "elimination"
@@ -312,5 +326,6 @@ main = do
312326 , o_1_space_serial_transformation value
313327 , o_1_space_serial_composition value
314328 ]
329+ , bgroup (o_n_space_prefix moduleName) (o_n_space_serial value)
315330 , bgroup (o_n_heap_prefix moduleName) (o_n_heap_serial value)
316331 ]