on master help sign in
Add grouping combinators to the benchmarks
875e48fadithyaov
benchmark/Streamly/Benchmark/Prelude/Serial.hs+40−4
@@ -1154,10 +1154,6 @@ dropWhileFalse value n = composeN n $ S.dropWhile (> (value + 1))
1154_intervalsOfSum :: MonadAsync m => Double -> Int -> SerialT m Int -> m ()
1154_intervalsOfSum :: MonadAsync m => Double -> Int -> SerialT m Int -> m ()
1155_intervalsOfSum i n = composeN n (S.intervalsOf i FL.sum)
1155_intervalsOfSum i n = composeN n (S.intervalsOf i FL.sum)
1156
1156
1157−-- S.groups
1158−-- S.groupsBy
1159−-- S.groupsByRolling
1160−
1161{-# INLINE dropByTime #-}
1157{-# INLINE dropByTime #-}
1162dropByTime :: NanoSecond64 -> Int -> SerialT IO Int -> IO ()
1158dropByTime :: NanoSecond64 -> Int -> SerialT IO Int -> IO ()
1163dropByTime i n = composeN n (Internal.dropByTime i)
1159dropByTime i n = composeN n (Internal.dropByTime i)
@@ -1286,6 +1282,46 @@ o_1_space_filteringX4 value =
1286 ]
1282 ]
1287 ]
1283 ]
1288
1284
1285+-------------------------------------------------------------------------------
1286+-- Grouping transformations
1287+-------------------------------------------------------------------------------
1288+
1289+{-# INLINE groups #-}
1290+groups :: MonadIO m => SerialT m Int -> m ()
1291+groups = S.drain . S.groups FL.drain
1292+
1293+-- XXX Change this test when the order of comparison is later changed
1294+{-# INLINE groupsByGT #-}
1295+groupsByGT :: MonadIO m => SerialT m Int -> m ()
1296+groupsByGT = S.drain . S.groupsBy (>) FL.drain
1297+
1298+{-# INLINE groupsByEq #-}
1299+groupsByEq :: MonadIO m => SerialT m Int -> m ()
1300+groupsByEq = S.drain . S.groupsBy (>) FL.drain
1301+
1302+-- XXX Change this test when the order of comparison is later changed
1303+{-# INLINE groupsByRollingLT #-}
1304+groupsByRollingLT :: MonadIO m => SerialT m Int -> m ()
1305+groupsByRollingLT =
1306+ S.drain . S.groupsByRolling (<) FL.drain
1307+
1308+{-# INLINE groupsByRollingEq #-}
1309+groupsByRollingEq :: MonadIO m => SerialT m Int -> m ()
1310+groupsByRollingEq =
1311+ S.drain . S.groupsByRolling (>) FL.drain
1312+
1313+o_1_space_grouping :: Int -> [Benchmark]
1314+o_1_space_grouping value =
1315+ -- Buffering operations using heap proportional to group/window sizes.
1316+ [ bgroup "grouping"
1317+ [ benchIOSink value "groups" groups
1318+ , benchIOSink value "groupsByGT" groupsByGT
1319+ , benchIOSink value "groupsByEq" groupsByEq
1320+ , benchIOSink value "groupsByRollingLT" groupsByRollingLT
1321+ , benchIOSink value "groupsByRollingEq" groupsByRollingEq
1322+ ]
1323+ ]
1324+
1289-------------------------------------------------------------------------------
1325-------------------------------------------------------------------------------
1290-- Size increasing transformations (insertions)
1326-- Size increasing transformations (insertions)
1291-------------------------------------------------------------------------------
1327-------------------------------------------------------------------------------