Add benchmarks for takeP

This commit is contained in:
Adithya Kumar 2021-08-01 16:45:31 +05:30 committed by Adithya Kumar
parent c375be2944
commit 15397be802
2 changed files with 10 additions and 0 deletions

View File

@ -97,6 +97,10 @@ sliceBeginWith value stream = do
takeWhile :: MonadCatch m => Int -> SerialT m Int -> m ()
takeWhile value = IP.parse (PR.takeWhile (<= value) FL.drain)
{-# INLINE takeP #-}
takeP :: MonadCatch m => Int -> SerialT m a -> m ()
takeP value = IP.parse (PR.takeP value (PR.fromFold FL.drain))
{-# INLINE groupBy #-}
groupBy :: MonadCatch m => SerialT m Int -> m ()
groupBy = IP.parse (PR.groupBy (<=) FL.drain)
@ -327,6 +331,7 @@ o_1_space_serial value =
[ benchIOSink value "takeBetween" $ takeBetween value
, benchIOSink value "takeEQ" $ takeEQ value
, benchIOSink value "takeWhile" $ takeWhile value
, benchIOSink value "takeP" $ takeP value
, benchIOSink value "drainWhile" $ drainWhile value
, benchIOSink value "sliceBeginWith" $ sliceBeginWith value
, benchIOSink value "groupBy" $ groupBy

View File

@ -79,6 +79,10 @@ sliceBeginWith value stream = do
takeWhile :: MonadThrow m => Int -> SerialT m Int -> m ()
takeWhile value = IP.parseD (drainWhile (<= value))
{-# INLINE takeP #-}
takeP :: MonadThrow m => Int -> SerialT m a -> m ()
takeP value = IP.parseD (PR.takeP value (PR.fromFold FL.drain))
{-# INLINE groupBy #-}
groupBy :: MonadThrow m => SerialT m Int -> m ()
groupBy = IP.parseD (PR.groupBy (<=) FL.drain)
@ -289,6 +293,7 @@ moduleName = "Data.Parser.ParserD"
o_1_space_serial :: Int -> [Benchmark]
o_1_space_serial value =
[ benchIOSink value "takeWhile" $ takeWhile value
, benchIOSink value "takeP" $ takeP value
, benchIOSink value "sliceBeginWith" $ sliceBeginWith value
, benchIOSink value "groupBy" $ groupBy
, benchIOSink value "groupByRolling" $ groupByRolling