on master help sign in
Add benchmark for tapAsync

StreamD style tapAsync is 2x faster than the previous implementation

commita00e05750a49b1c20b9f1289e83301c479d92373 authorHarendra Kumar <harendra.kumar@gmail.com> dateTue 17 Dec 2019, 17:38 (7 years ago) parent9465fc0
2 files changed+5
benchmark/Linear.hs+1 benchmark/Streamly/Benchmark/Prelude.hs+4
benchmark/Linear.hs+1
@@ -319,6 +319,7 @@ main =
319319 , benchIOSink "foldrT" (Ops.foldrT 1)
320320 , benchIOSink "foldrTMap" (Ops.foldrTMap 1)
321321 , benchIOSink "tap" (Ops.tap 1)
322+ , benchIOSink "tapAsync" (Ops.tapAsync 1)
322323 , benchIOSink "tapAsyncS" (Ops.tapAsyncS 1)
323324 ]
324325 , bgroup "transformationX4"
benchmark/Streamly/Benchmark/Prelude.hs+4
@@ -444,6 +444,10 @@ tap n = composeN n $ S.tap FL.sum
444444tapAsyncS :: S.MonadAsync m => Int -> Stream m Int -> m ()
445445tapAsyncS n = composeN n $ Par.tapAsync S.sum
446446
447+{-# INLINE tapAsync #-}
448+tapAsync :: S.MonadAsync m => Int -> Stream m Int -> m ()
449+tapAsync n = composeN n $ Internal.tapAsync FL.sum
450+
447451{-# INLINE transformMapM #-}
448452{-# INLINE transformComposeMapM #-}
449453{-# INLINE transformTeeMapM #-}