From acd1b6e97e5ad052dc0bad5cd9a078b0afd6790f Mon Sep 17 00:00:00 2001 From: carm Date: Wed, 11 Feb 2015 23:08:12 -0500 Subject: [PATCH] put back more advanced resize heuristic --- src/data/CCBufferIO.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/data/CCBufferIO.ml b/src/data/CCBufferIO.ml index 8207540b..91ccd026 100644 --- a/src/data/CCBufferIO.ml +++ b/src/data/CCBufferIO.ml @@ -71,8 +71,8 @@ let blit_from b from_buf o len = if (Array.length from_buf) = 0 then () else let cap = capacity b - length b in (* resize if needed, with a constant to amortize *) - if capacity b < b.size then - resize b b.size from_buf.(0); + if cap < len then + resize b (min b.size (Array.length b.buf + len + 24)) from_buf.(0); let sub = Array.sub from_buf o len in let iter i x = b.start <- i mod capacity b;