on master help sign in
Add benchmarks for scan and postscan
commit7fd5ab1bee9c2f4b415e1746bff651ba5049f885 authoradithyaov <adithya@composewell.com> dateMon 23 Nov 2020, 14:31 (6 years ago) parent3a3f8e7
1 file changed+10
benchmark/Streamly/Benchmark/Prelude/Serial.hs+10
benchmark/Streamly/Benchmark/Prelude/Serial.hs+10
@@ -876,6 +876,10 @@ scanl1' n = composeN n $ S.scanl1' (+)
876876scanl1M' :: MonadIO m => Int -> SerialT m Int -> m ()
877877scanl1M' n = composeN n $ S.scanl1M' (\b a -> return $ b + a)
878878
879+{-# INLINE scan #-}
880+scan :: MonadIO m => Int -> SerialT m Int -> m ()
881+scan n = composeN n $ S.scan FL.sum
882+
879883{-# INLINE postscanl' #-}
880884postscanl' :: MonadIO m => Int -> SerialT m Int -> m ()
881885postscanl' n = composeN n $ S.postscanl' (+) 0
@@ -884,6 +888,10 @@ postscanl' n = composeN n $ S.postscanl' (+) 0
884888postscanlM' :: MonadIO m => Int -> SerialT m Int -> m ()
885889postscanlM' n = composeN n $ S.postscanlM' (\b a -> return $ b + a) (return 0)
886890
891+{-# INLINE postscan #-}
892+postscan :: MonadIO m => Int -> SerialT m Int -> m ()
893+postscan n = composeN n $ S.postscan FL.sum
894+
887895{-# INLINE sequence #-}
888896sequence ::
889897 (S.IsStream t, S.MonadAsync m)
@@ -965,6 +973,8 @@ o_1_space_mapping value =
965973 , benchIOSink value "postscanl'" (postscanl' 1)
966974 , benchIOSink value "postscanlM'" (postscanlM' 1)
967975
976+ , benchIOSink value "scan" (scan 1)
977+ , benchIOSink value "postscan" (postscan 1)
968978 ]
969979 ]
970980