@@ -11,6 +11,7 @@
11{-# LANGUAGE DeriveAnyClass #-}
11{-# LANGUAGE DeriveAnyClass #-}
12{-# LANGUAGE DeriveGeneric #-}
12{-# LANGUAGE DeriveGeneric #-}
13{-# LANGUAGE RankNTypes #-}
13{-# LANGUAGE RankNTypes #-}
14+{-# LANGUAGE TupleSections #-}
15#ifdef __HADDOCK_VERSION__
16#ifdef __HADDOCK_VERSION__
16#undef INSPECTION
17#undef INSPECTION
@@ -48,7 +49,7 @@ module Streamly.Benchmark.Prelude
49 , o_1_space_zipSerial_transformation
50 , o_1_space_zipSerial_transformation
51− , o_n_space_serial_toList
52+ , o_n_space_serial_toContainers
52 , o_n_space_serial_outerProductStreams
53 , o_n_space_serial_outerProductStreams
54 , o_n_space_wSerial_outerProductStreams
55 , o_n_space_wSerial_outerProductStreams
@@ -101,9 +102,9 @@ import GHC.Generics (Generic)
101import System.Random (randomRIO)
102import System.Random (randomRIO)
102import Prelude
103import Prelude
103 (Monad, String, Int, (+), ($), (.), return, even, (>), (<=), (==), (>=),
104 (Monad, String, Int, (+), ($), (.), return, even, (>), (<=), (==), (>=),
104− subtract, undefined, Maybe(..), Bool, not, (>>=), curry,
105+ subtract, undefined, Maybe(..), Bool(..), not, (>>=), curry,
105 maxBound, div, IO, compare, Double, fromIntegral, Integer, (<$>),
106 maxBound, div, IO, compare, Double, fromIntegral, Integer, (<$>),
106− (<*>), flip, sqrt, round, (*), seq)
107+ (<*>), flip, sqrt, round, (*), seq, const, Either(..))
107import qualified Prelude as P
108import qualified Prelude as P
108import qualified Data.Foldable as F
109import qualified Data.Foldable as F
109import qualified GHC.Exts as GHC
110import qualified GHC.Exts as GHC
@@ -549,6 +550,15 @@ tapAsync n = composeN n $ Internal.tapAsync FL.sum
549timestamped :: (S.MonadAsync m) => Stream m Int -> m ()
550timestamped :: (S.MonadAsync m) => Stream m Int -> m ()
550timestamped = transform . Internal.timestamped
551timestamped = transform . Internal.timestamped
553+{-# INLINE classifySessionsOf #-}
554+classifySessionsOf :: (S.MonadAsync m) => Stream m Int -> m ()
557+ . IP.classifySessionsOf 3 (const (return False)) (P.fmap Right FL.drain)
558+ . S.map (\(ts,(k,a)) -> (k, a, ts))
560+ . S.concatMap (\x -> S.map (x,) (S.enumerateFromTo 1 (10 :: Int)))
552{-# INLINE mapMaybe #-}
562{-# INLINE mapMaybe #-}
553mapMaybe :: MonadIO m => Int -> Stream m Int -> m ()
563mapMaybe :: MonadIO m => Int -> Stream m Int -> m ()
554mapMaybe n =
564mapMaybe n =
@@ -2128,8 +2138,8 @@ o_1_space_zipSerial_transformation value =
2128-- Serial : O(n) Space
2138-- Serial : O(n) Space
2129-------------------------------------------------------------------------------
2139-------------------------------------------------------------------------------
2131−o_n_space_serial_toList :: Int -> [Benchmark]
2141+o_n_space_serial_toContainers :: Int -> [Benchmark]
2132−o_n_space_serial_toList value =
2142+o_n_space_serial_toContainers value =
2133 [ bgroup
2143 [ bgroup
2134 "serially"
2144 "serially"
2135 [ bgroup
2145 [ bgroup
@@ -2141,6 +2151,8 @@ o_n_space_serial_toList value =
2141 -- , benchIOSink value "toPure" toPure
2151 -- , benchIOSink value "toPure" toPure
2142 -- , benchIOSink value "toPureRev" toPureRev
2152 -- , benchIOSink value "toPureRev" toPureRev
2154+ , benchIOSink (value `div` 10) "classifySessionsOf"