@@ -62,17 +62,6 @@ benchIOSink
6262benchIOSink value name f =
6363 bench name $ nfIO $ randomRIO (1,1) >>= f . sourceUnfoldrM value
6464
65−-- Make the input unsorted.
66−{-# INLINE benchIOSinkRandom #-}
67−benchIOSinkRandom
68− :: (NFData b)
69− => Int -> String -> (Stream IO Int -> IO b) -> Benchmark
70−benchIOSinkRandom value name f =
71− bench name $ nfIO $ randomRIO (1,1)
72− >>= f
73− . fmap (\x -> if even x then x + 2 else x)
74− . sourceUnfoldrM value
75−
7665-------------------------------------------------------------------------------
7766-- Parsers
7867-------------------------------------------------------------------------------
@@ -252,6 +241,7 @@ parseManyGroupsRollingEitherAlt :: (MonadThrow m, MonadCatch m) =>
252241 (Int -> Int -> Bool) -> Int -> m ()
253242parseManyGroupsRollingEitherAlt cmp value = do
254243 sourceUnfoldrM value 1
244+ -- Make the input unsorted.
255245 & fmap (\x -> if even x then x + 2 else x)
256246 & Stream.parseManyD (PR.groupByRollingEither cmp Fold.drain Fold.drain)
257247 & Stream.fold Fold.drain
@@ -285,6 +275,7 @@ lookAhead :: MonadThrow m => Int -> Stream m Int -> m ()
285275lookAhead value =
286276 Stream.parseD (PR.lookAhead (PR.takeWhile (<= value) Fold.drain) $> ())
287277
278+-- XXX The timing of this increased 3x after the stepify extract changes.
288279{-# INLINE sequenceA_ #-}
289280sequenceA_ :: MonadThrow m => Int -> Stream m Int -> m ()
290281sequenceA_ value =
@@ -380,13 +371,25 @@ o_1_space_serial_nested value =
380371 , benchIOSink value "parseMany groupRollingBy (1 group)"
381372 $ parseManyGroupsRolling True
382373 , bench "parseMany groupRollingByEither (Left)"
383− $ nfIO $ parseManyGroupsRollingEither (<) value
374+ $ nfIO $ parseManyGroupsRollingEitherLeft
384375 , bench "parseMany groupRollingByEither (Right)"
385− $ nfIO $ parseManyGroupsRollingEither (>) value
376+ $ nfIO $ parseManyGroupsRollingEitherRight
386377 , bench "parseMany groupRollingByEither (Alternating)"
387− $ nfIO $ parseManyGroupsRollingEitherAlt (>) value
378+ $ nfIO $ parseManyGroupsRollingEitherAlt1
388379 ]
389380
381+ where
382+
383+ {-# NOINLINE parseManyGroupsRollingEitherLeft #-}
384+ parseManyGroupsRollingEitherLeft = parseManyGroupsRollingEither (<) value
385+
386+ {-# NOINLINE parseManyGroupsRollingEitherRight #-}
387+ parseManyGroupsRollingEitherRight = parseManyGroupsRollingEither (>) value
388+
389+ {-# NOINLINE parseManyGroupsRollingEitherAlt1 #-}
390+ parseManyGroupsRollingEitherAlt1 =
391+ parseManyGroupsRollingEitherAlt (>) value
392+
390393o_1_space_serial_unfold :: Int -> [Array.Array Int] -> [Benchmark]
391394o_1_space_serial_unfold bound arrays =
392395 [ bench "parseMany/Unfold/1000 arrays/1 parse"