on master help sign in
Fix naming in benchmarks

* bench:Prelude.Serial - foldrMToStream -> foldrToStream - scan -> scanl' * bench:Prelude.ZipSerial - zip -> zipWith - zipM -> zipWithM * bench:Prelude.ZipAsync - zipAsync -> zipAsyncWith - zipAsyncM -> zipAsyncWithM

commit053a38c6a1085572e23f0a4229c7b5641ccaeaef authoradithyaov <adithya@composewell.com> dateWed 11 Nov 2020, 22:40 (6 years ago) parentf10c944
3 files changed+35−33
benchmark/Streamly/Benchmark/Prelude/Serial.hs+10−10 benchmark/Streamly/Benchmark/Prelude/ZipAsync.hs+10−8 benchmark/Streamly/Benchmark/Prelude/ZipSerial.hs+15−15
benchmark/Streamly/Benchmark/Prelude/Serial.hs+10−10
@@ -437,9 +437,9 @@ foldrMElem e =
437437 else xs)
438438 (return P.False)
439439
440−{-# INLINE foldrMToStream #-}
441−foldrMToStream :: Monad m => SerialT m Int -> m (SerialT Identity Int)
442−foldrMToStream = S.foldr S.cons S.nil
440+{-# INLINE foldrToStream #-}
441+foldrToStream :: Monad m => SerialT m Int -> m (SerialT Identity Int)
442+foldrToStream = S.foldr S.cons S.nil
443443
444444{-# INLINE foldrMBuild #-}
445445foldrMBuild :: Monad m => SerialT m Int -> m [Int]
@@ -573,8 +573,8 @@ o_1_space_elimination_folds value =
573573 ]
574574 , bgroup "Identity"
575575 [ benchIdentitySink value "foldrMElem" (foldrMElem value)
576− , benchIdentitySink value "foldrMToStreamLength"
577− (S.length . runIdentity . foldrMToStream)
576+ , benchIdentitySink value "foldrToStreamLength"
577+ (S.length . runIdentity . foldrToStream)
578578 , benchPureSink value "foldrMToListLength"
579579 (P.length . runIdentity . foldrMBuild)
580580 ]
@@ -855,9 +855,9 @@ o_n_space_traversable value =
855855-- maps and scans
856856-------------------------------------------------------------------------------
857857
858−{-# INLINE scan #-}
859−scan :: MonadIO m => Int -> SerialT m Int -> m ()
860−scan n = composeN n $ S.scanl' (+) 0
858+{-# INLINE scanl' #-}
859+scanl' :: MonadIO m => Int -> SerialT m Int -> m ()
860+scanl' n = composeN n $ S.scanl' (+) 0
861861
862862{-# INLINE scanlM' #-}
863863scanlM' :: MonadIO m => Int -> SerialT m Int -> m ()
@@ -949,7 +949,7 @@ o_1_space_mapping value =
949949 , benchIOSink value "timestamped" timestamped
950950
951951 -- Scanning
952− , benchIOSink value "scanl'" (scan 1)
952+ , benchIOSink value "scanl'" (scanl' 1)
953953 , benchIOSink value "scanl1'" (scanl1' 1)
954954 , benchIOSink value "scanlM'" (scanlM' 1)
955955 , benchIOSink value "postscanl'" (postscanl' 1)
@@ -965,7 +965,7 @@ o_1_space_mappingX4 value =
965965 , benchIOSink value "mapM" (mapM serially 4)
966966 , benchIOSink value "trace" (trace 4)
967967
968− , benchIOSink value "scan" (scan 4)
968+ , benchIOSink value "scanl'" (scanl' 4)
969969 , benchIOSink value "scanl1'" (scanl1' 4)
970970 , benchIOSink value "scanlM'" (scanlM' 4)
971971 , benchIOSink value "postscanl'" (postscanl' 4)
benchmark/Streamly/Benchmark/Prelude/ZipAsync.hs+10−8
@@ -22,14 +22,14 @@ moduleName = "Prelude.ZipAsync"
2222-- Zipping
2323-------------------------------------------------------------------------------
2424
25−{-# INLINE zipAsync #-}
26−zipAsync :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
27−zipAsync count n =
25+{-# INLINE zipAsyncWith #-}
26+zipAsyncWith :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
27+zipAsyncWith count n =
2828 S.zipAsyncWith (,) (sourceUnfoldrM count n) (sourceUnfoldrM count (n + 1))
2929
30−{-# INLINE zipAsyncM #-}
31−zipAsyncM :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
32−zipAsyncM count n =
30+{-# INLINE zipAsyncWithM #-}
31+zipAsyncWithM :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
32+zipAsyncWithM count n =
3333 S.zipAsyncWithM
3434 (curry return)
3535 (sourceUnfoldrM count n)
@@ -44,8 +44,10 @@ zipAsyncAp count n =
4444o_1_space_joining :: Int -> [Benchmark]
4545o_1_space_joining value =
4646 [ bgroup "joining"
47− [ benchIOSrc serially "zipAsync (2,x/2)" (zipAsync (value `div` 2))
48− , benchIOSrc serially "zipAsyncM (2,x/2)" (zipAsyncM (value `div` 2))
47+ [ benchIOSrc serially "zipAsyncWith (2,x/2)" (zipAsyncWith
48+ (value `div` 2))
49+ , benchIOSrc serially "zipAsyncWithM (2,x/2)" (zipAsyncWithM
50+ (value `div` 2))
4951 , benchIOSrc serially "zipAsyncAp (2,x/2)" (zipAsyncAp (value `div` 2))
5052 , benchIOSink value "fmap zipAsyncly" $ fmapN S.zipAsyncly 1
5153 ]
benchmark/Streamly/Benchmark/Prelude/ZipSerial.hs+15−15
@@ -19,7 +19,7 @@
1919{-# OPTIONS_GHC -fplugin Test.Inspection.Plugin #-}
2020#endif
2121
22−import Prelude hiding (zip)
22+import Prelude hiding (zipWith)
2323
2424import Streamly.Prelude (MonadAsync)
2525import qualified Streamly.Prelude as S
@@ -54,9 +54,9 @@ sourceUnfoldrM count start = S.unfoldrM step start
5454 then return Nothing
5555 else return (Just (cnt, cnt + 1))
5656
57−{-# INLINE zip #-}
58−zip :: Int -> Int -> IO ()
59−zip count n =
57+{-# INLINE zipWith #-}
58+zipWith :: Int -> Int -> IO ()
59+zipWith count n =
6060 S.drain $
6161 S.zipWith
6262 (,)
@@ -64,14 +64,14 @@ zip count n =
6464 (S.serially $ sourceUnfoldrM count (n + 1))
6565
6666#ifdef INSPECTION
67−inspect $ hasNoTypeClasses 'zip
68−inspect $ 'zip `hasNoType` ''SPEC
69−inspect $ 'zip `hasNoType` ''D.Step
67+inspect $ hasNoTypeClasses 'zipWith
68+inspect $ 'zipWith `hasNoType` ''SPEC
69+inspect $ 'zipWith `hasNoType` ''D.Step
7070#endif
7171
72−{-# INLINE zipM #-}
73−zipM :: Int -> Int -> IO ()
74−zipM count n =
72+{-# INLINE zipWithM #-}
73+zipWithM :: Int -> Int -> IO ()
74+zipWithM count n =
7575 S.drain $
7676 S.zipWithM
7777 (curry return)
@@ -79,16 +79,16 @@ zipM count n =
7979 (sourceUnfoldrM count (n + 1))
8080
8181#ifdef INSPECTION
82−inspect $ hasNoTypeClasses 'zipM
83−inspect $ 'zipM `hasNoType` ''SPEC
84−inspect $ 'zipM `hasNoType` ''D.Step
82+inspect $ hasNoTypeClasses 'zipWithM
83+inspect $ 'zipWithM `hasNoType` ''SPEC
84+inspect $ 'zipWithM `hasNoType` ''D.Step
8585#endif
8686
8787o_1_space_joining :: Int -> [Benchmark]
8888o_1_space_joining value =
8989 [ bgroup "joining"
90− [ benchIOSrc1 "zip (2,x/2)" (zip (value `div` 2))
91− , benchIOSrc1 "zipM (2,x/2)" (zipM (value `div` 2))
90+ [ benchIOSrc1 "zip (2,x/2)" (zipWith (value `div` 2))
91+ , benchIOSrc1 "zipM (2,x/2)" (zipWithM (value `div` 2))
9292 ]
9393 ]
9494