@@ -22,10 +22,11 @@
22import Prelude hiding (zip)
22import Prelude hiding (zip)
24import Streamly (zipSerially)
24import Streamly (zipSerially)
25+import qualified Streamly as S
25import qualified Streamly.Prelude as S
26import qualified Streamly.Prelude as S
27import Streamly.Benchmark.Common
28import Streamly.Benchmark.Common
28−import Streamly.Benchmark.Prelude
29+import Streamly.Benchmark.Prelude hiding (sourceUnfoldrMN)
30import Gauge
31import Gauge
@@ -43,11 +44,22 @@ moduleName = "Prelude.ZipSerial"
44-------------------------------------------------------------------------------
45-------------------------------------------------------------------------------
47+-- XXX somehow copying this definition here instead of importing it performs
48+-- better. Need to investigate why.
49+{-# INLINE sourceUnfoldrMN #-}
50+sourceUnfoldrMN :: (S.IsStream t, S.MonadAsync m) => Int -> Int -> t m Int
51+sourceUnfoldrMN count start = S.unfoldrM step start
54+ if cnt > start + count
56+ else return (Just (cnt, cnt + 1))
46{-# INLINE zip #-}
58{-# INLINE zip #-}
47zip :: Int -> Int -> IO ()
59zip :: Int -> Int -> IO ()
48zip count n =
60zip count n =
50− S.zipWith (,) (sourceUnfoldrMN count n) (sourceUnfoldrMN count (n + 1))
62+ S.zipWith (,) (S.serially $ sourceUnfoldrMN count n) (S.serially $ sourceUnfoldrMN count (n + 1))
52#ifdef INSPECTION
64#ifdef INSPECTION
53inspect $ hasNoTypeClasses 'zip
65inspect $ hasNoTypeClasses 'zip