on master help sign in
Add comments
commitc8955fe18be864f847bde8af3e67fbdfe787ca0f authorHarendra Kumar <harendra.kumar@gmail.com> dateTue 14 May 2019, 19:13 (7 years ago) parent5da5f25
1 file changed+5
src/Streamly/Array/Types.hs+5
src/Streamly/Array/Types.hs+5
@@ -469,6 +469,11 @@ flattenArraysRev (D.Stream step state) = D.Stream step' (OuterLoop state)
469469-- due to GC overhead because we need to buffer the arrays before we flatten
470470-- all the arrays.
471471--
472+-- We could take the approach of doubling the memory allocation on each
473+-- overflow. This would result in more or less the same amount of copying as in
474+-- the chunking approach. However, if we have to shrink in the end then it may
475+-- result in an extra copy of the entire data.
476+--
472477{-# INLINE fromStreamD #-}
473478fromStreamD :: (MonadIO m, Storable a) => D.Stream m a -> m (Array a)
474479fromStreamD m = do