on master help sign in
Reallocate only once in lpackArraysChunksOf
commit006fc5fcfeb8612640830ccef7c4926b7c165730 authorHarendra Kumar <harendra.kumar@gmail.com> dateFri 13 Sep 2019, 11:44 (7 years ago) parent7a8227e
2 files changed+3−2
src/Streamly/Benchmark/FileIO/Array.hs+2−1 src/Streamly/Memory/Array/Types.hs+1−1
src/Streamly/Benchmark/FileIO/Array.hs+2−1
@@ -41,6 +41,7 @@ import qualified Streamly.Prelude as S
4141import qualified Streamly.Internal as Internal
4242
4343#ifdef INSPECTION
44+import Foreign.Storable (Storable)
4445import Streamly.Streams.StreamD.Type (Step(..))
4546import Test.Inspection
4647#endif
@@ -128,6 +129,6 @@ linesUnlinesCopy inh outh =
128129 $ FH.readArraysOf (1024*1024) inh
129130
130131#ifdef INSPECTION
131−-- inspect $ hasNoTypeClasses 'linesUnlinesCopy
132+inspect $ hasNoTypeClassesExcept 'linesUnlinesCopy [''Storable]
132133-- inspect $ 'linesUnlinesCopy `hasNoType` ''Step
133134#endif
src/Streamly/Memory/Array/Types.hs+1−1
@@ -1087,7 +1087,7 @@ lpackArraysChunksOf n (Fold step1 initial1 extract1) =
10871087 step (Tuple' (Just buf) r1) arr = do
10881088 let len = byteLength buf + byteLength arr
10891089 buf' <- if byteCapacity buf < len
1090− then liftIO $ realloc len buf
1090+ then liftIO $ realloc (max n len) buf
10911091 else return buf
10921092 buf'' <- spliceWith buf' arr
10931093