on master help sign in
Add benchmarks for fromIndices and fromIndicesM.
commit218b48a1a33916251e1a6e87f517facc32629e00 authorPranay Sashank <pranaysashank@gmail.com> dateSat 1 Jun 2019, 21:47 (7 years ago) parent7758b11
1 file changed+8
benchmark/LinearOps.hs+8
benchmark/LinearOps.hs+8
@@ -85,6 +85,14 @@ sourceFromList n = S.fromList [n..n+value]
8585sourceFromListM :: (S.MonadAsync m, S.IsStream t) => Int -> t m Int
8686sourceFromListM n = S.fromListM (Prelude.fmap return [n..n+value])
8787
88+{-# INLINE sourceFromIndices #-}
89+sourceFromIndices :: (Monad m, S.IsStream t) => Int -> t m Int
90+sourceFromIndices n = S.take value $ S.fromIndices (+ n)
91+
92+{-# INLINE sourceFromIndicesM #-}
93+sourceFromIndicesM :: (S.MonadAsync m, S.IsStream t) => Int -> t m Int
94+sourceFromIndicesM n = S.take value $ S.fromIndicesM (Prelude.fmap return (+ n))
95+
8896{-# INLINE sourceFromFoldable #-}
8997sourceFromFoldable :: S.IsStream t => Int -> t m Int
9098sourceFromFoldable n = S.fromFoldable [n..n+value]