on master help sign in
Fix naming in benchmarks
053a38cadithyaov
benchmark/Streamly/Benchmark/Prelude/Serial.hs+10−10
@@ -437,9 +437,9 @@ foldrMElem e =
437 else xs)
437 else xs)
438 (return P.False)
438 (return P.False)
439
439
440−{-# INLINE foldrMToStream #-}
440+{-# INLINE foldrToStream #-}
441−foldrMToStream :: Monad m => SerialT m Int -> m (SerialT Identity Int)
441+foldrToStream :: Monad m => SerialT m Int -> m (SerialT Identity Int)
442−foldrMToStream = S.foldr S.cons S.nil
442+foldrToStream = S.foldr S.cons S.nil
443
443
444{-# INLINE foldrMBuild #-}
444{-# INLINE foldrMBuild #-}
445foldrMBuild :: Monad m => SerialT m Int -> m [Int]
445foldrMBuild :: Monad m => SerialT m Int -> m [Int]
@@ -573,8 +573,8 @@ o_1_space_elimination_folds value =
573 ]
573 ]
574 , bgroup "Identity"
574 , bgroup "Identity"
575 [ benchIdentitySink value "foldrMElem" (foldrMElem value)
575 [ benchIdentitySink value "foldrMElem" (foldrMElem value)
576− , benchIdentitySink value "foldrMToStreamLength"
576+ , benchIdentitySink value "foldrToStreamLength"
577− (S.length . runIdentity . foldrMToStream)
577+ (S.length . runIdentity . foldrToStream)
578 , benchPureSink value "foldrMToListLength"
578 , benchPureSink value "foldrMToListLength"
579 (P.length . runIdentity . foldrMBuild)
579 (P.length . runIdentity . foldrMBuild)
580 ]
580 ]
@@ -855,9 +855,9 @@ o_n_space_traversable value =
855-- maps and scans
855-- maps and scans
856-------------------------------------------------------------------------------
856-------------------------------------------------------------------------------
857
857
858−{-# INLINE scan #-}
858+{-# INLINE scanl' #-}
859−scan :: MonadIO m => Int -> SerialT m Int -> m ()
859+scanl' :: MonadIO m => Int -> SerialT m Int -> m ()
860−scan n = composeN n $ S.scanl' (+) 0
860+scanl' n = composeN n $ S.scanl' (+) 0
861
861
862{-# INLINE scanlM' #-}
862{-# INLINE scanlM' #-}
863scanlM' :: MonadIO m => Int -> SerialT m Int -> m ()
863scanlM' :: MonadIO m => Int -> SerialT m Int -> m ()
@@ -949,7 +949,7 @@ o_1_space_mapping value =
949 , benchIOSink value "timestamped" timestamped
949 , benchIOSink value "timestamped" timestamped
950
950
951 -- Scanning
951 -- Scanning
952− , benchIOSink value "scanl'" (scan 1)
952+ , benchIOSink value "scanl'" (scanl' 1)
953 , benchIOSink value "scanl1'" (scanl1' 1)
953 , benchIOSink value "scanl1'" (scanl1' 1)
954 , benchIOSink value "scanlM'" (scanlM' 1)
954 , benchIOSink value "scanlM'" (scanlM' 1)
955 , benchIOSink value "postscanl'" (postscanl' 1)
955 , benchIOSink value "postscanl'" (postscanl' 1)
@@ -965,7 +965,7 @@ o_1_space_mappingX4 value =
965 , benchIOSink value "mapM" (mapM serially 4)
965 , benchIOSink value "mapM" (mapM serially 4)
966 , benchIOSink value "trace" (trace 4)
966 , benchIOSink value "trace" (trace 4)
967
967
968− , benchIOSink value "scan" (scan 4)
968+ , benchIOSink value "scanl'" (scanl' 4)
969 , benchIOSink value "scanl1'" (scanl1' 4)
969 , benchIOSink value "scanl1'" (scanl1' 4)
970 , benchIOSink value "scanlM'" (scanlM' 4)
970 , benchIOSink value "scanlM'" (scanlM' 4)
971 , benchIOSink value "postscanl'" (postscanl' 4)
971 , benchIOSink value "postscanl'" (postscanl' 4)
benchmark/Streamly/Benchmark/Prelude/ZipAsync.hs+10−8
@@ -22,14 +22,14 @@ moduleName = "Prelude.ZipAsync"
22-- Zipping
22-- Zipping
23-------------------------------------------------------------------------------
23-------------------------------------------------------------------------------
24
24
25−{-# INLINE zipAsync #-}
25+{-# INLINE zipAsyncWith #-}
26−zipAsync :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
26+zipAsyncWith :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
27−zipAsync count n =
27+zipAsyncWith count n =
28 S.zipAsyncWith (,) (sourceUnfoldrM count n) (sourceUnfoldrM count (n + 1))
28 S.zipAsyncWith (,) (sourceUnfoldrM count n) (sourceUnfoldrM count (n + 1))
29
29
30−{-# INLINE zipAsyncM #-}
30+{-# INLINE zipAsyncWithM #-}
31−zipAsyncM :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
31+zipAsyncWithM :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m (Int, Int)
32−zipAsyncM count n =
32+zipAsyncWithM count n =
33 S.zipAsyncWithM
33 S.zipAsyncWithM
34 (curry return)
34 (curry return)
35 (sourceUnfoldrM count n)
35 (sourceUnfoldrM count n)
@@ -44,8 +44,10 @@ zipAsyncAp count n =
44o_1_space_joining :: Int -> [Benchmark]
44o_1_space_joining :: Int -> [Benchmark]
45o_1_space_joining value =
45o_1_space_joining value =
46 [ bgroup "joining"
46 [ bgroup "joining"
47− [ benchIOSrc serially "zipAsync (2,x/2)" (zipAsync (value `div` 2))
47+ [ benchIOSrc serially "zipAsyncWith (2,x/2)" (zipAsyncWith
48+ (value `div` 2))
48− , benchIOSrc serially "zipAsyncM (2,x/2)" (zipAsyncM (value `div` 2))
49+ , benchIOSrc serially "zipAsyncWithM (2,x/2)" (zipAsyncWithM
50+ (value `div` 2))
49 , benchIOSrc serially "zipAsyncAp (2,x/2)" (zipAsyncAp (value `div` 2))
51 , benchIOSrc serially "zipAsyncAp (2,x/2)" (zipAsyncAp (value `div` 2))
50 , benchIOSink value "fmap zipAsyncly" $ fmapN S.zipAsyncly 1
52 , benchIOSink value "fmap zipAsyncly" $ fmapN S.zipAsyncly 1
51 ]
53 ]
benchmark/Streamly/Benchmark/Prelude/ZipSerial.hs+15−15
@@ -19,7 +19,7 @@
19{-# OPTIONS_GHC -fplugin Test.Inspection.Plugin #-}
19{-# OPTIONS_GHC -fplugin Test.Inspection.Plugin #-}
20#endif
20#endif
21
21
22−import Prelude hiding (zip)
22+import Prelude hiding (zipWith)
23
23
24import Streamly.Prelude (MonadAsync)
24import Streamly.Prelude (MonadAsync)
25import qualified Streamly.Prelude as S
25import qualified Streamly.Prelude as S
@@ -54,9 +54,9 @@ sourceUnfoldrM count start = S.unfoldrM step start
54 then return Nothing
54 then return Nothing
55 else return (Just (cnt, cnt + 1))
55 else return (Just (cnt, cnt + 1))
56
56
57−{-# INLINE zip #-}
57+{-# INLINE zipWith #-}
58−zip :: Int -> Int -> IO ()
58+zipWith :: Int -> Int -> IO ()
59−zip count n =
59+zipWith count n =
60 S.drain $
60 S.drain $
61 S.zipWith
61 S.zipWith
62 (,)
62 (,)
@@ -64,14 +64,14 @@ zip count n =
64 (S.serially $ sourceUnfoldrM count (n + 1))
64 (S.serially $ sourceUnfoldrM count (n + 1))
65
65
66#ifdef INSPECTION
66#ifdef INSPECTION
67−inspect $ hasNoTypeClasses 'zip
67+inspect $ hasNoTypeClasses 'zipWith
68−inspect $ 'zip `hasNoType` ''SPEC
68+inspect $ 'zipWith `hasNoType` ''SPEC
69−inspect $ 'zip `hasNoType` ''D.Step
69+inspect $ 'zipWith `hasNoType` ''D.Step
70#endif
70#endif
71
71
72−{-# INLINE zipM #-}
72+{-# INLINE zipWithM #-}
73−zipM :: Int -> Int -> IO ()
73+zipWithM :: Int -> Int -> IO ()
74−zipM count n =
74+zipWithM count n =
75 S.drain $
75 S.drain $
76 S.zipWithM
76 S.zipWithM
77 (curry return)
77 (curry return)
@@ -79,16 +79,16 @@ zipM count n =
79 (sourceUnfoldrM count (n + 1))
79 (sourceUnfoldrM count (n + 1))
80
80
81#ifdef INSPECTION
81#ifdef INSPECTION
82−inspect $ hasNoTypeClasses 'zipM
82+inspect $ hasNoTypeClasses 'zipWithM
83−inspect $ 'zipM `hasNoType` ''SPEC
83+inspect $ 'zipWithM `hasNoType` ''SPEC
84−inspect $ 'zipM `hasNoType` ''D.Step
84+inspect $ 'zipWithM `hasNoType` ''D.Step
85#endif
85#endif
86
86
87o_1_space_joining :: Int -> [Benchmark]
87o_1_space_joining :: Int -> [Benchmark]
88o_1_space_joining value =
88o_1_space_joining value =
89 [ bgroup "joining"
89 [ bgroup "joining"
90− [ benchIOSrc1 "zip (2,x/2)" (zip (value `div` 2))
90+ [ benchIOSrc1 "zip (2,x/2)" (zipWith (value `div` 2))
91− , benchIOSrc1 "zipM (2,x/2)" (zipM (value `div` 2))
91+ , benchIOSrc1 "zipM (2,x/2)" (zipWithM (value `div` 2))
92 ]
92 ]
93 ]
93 ]
94
94