on master help sign in
Add comments about the performance of fromStream
3d7b270Harendra Kumar
src/Streamly/Internal/Data/Unfold.hs+3−1
@@ -424,7 +424,6 @@ mapMWithInput f (Unfold ustep uinject) = Unfold step inject
424-- Convert streams into unfolds
424-- Convert streams into unfolds
425-------------------------------------------------------------------------------
425-------------------------------------------------------------------------------
426
426
427−-- this is horribly slow
428{-# INLINE_NORMAL fromStreamD #-}
427{-# INLINE_NORMAL fromStreamD #-}
429fromStreamD :: Monad m => Unfold m (Stream m a) a
428fromStreamD :: Monad m => Unfold m (Stream m a) a
430fromStreamD = Unfold step return
429fromStreamD = Unfold step return
@@ -451,6 +450,9 @@ fromStreamK = Unfold step return
451 Just (x, xs) -> Yield x xs
450 Just (x, xs) -> Yield x xs
452 Nothing -> Stop
451 Nothing -> Stop
453
452
453+-- XXX Using Unfold.fromStreamD seems to be faster (using cross product test
454+-- case) than using fromStream even if it is implemented using fromStreamD.
455+--
454-- | Convert a stream into an 'Unfold'. Note that a stream converted to an
456-- | Convert a stream into an 'Unfold'. Note that a stream converted to an
455-- 'Unfold' may not be as efficient as an 'Unfold' in some situations.
457-- 'Unfold' may not be as efficient as an 'Unfold' in some situations.
456--
458--