From 60baee5585d07fc5d7526b7b64e85e742cd4ed3e Mon Sep 17 00:00:00 2001 From: Yuriy Glukhov Date: Fri, 12 Aug 2016 16:17:16 +0300 Subject: [PATCH] Optimised png decoding --- nimz.nim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nimz.nim b/nimz.nim index 79354fd..201b6fa 100644 --- a/nimz.nim +++ b/nimz.nim @@ -1221,8 +1221,8 @@ proc nzDeflateInit*(input: string): nzStream = proc nzInflateInit*(input: string): nzStream = var nz = nzInit() - nz.data = "" - nz.bits.data = input + nz.data = newStringOfCap(1024 * 1024 * 5) # Allocate 5MB in advance + shallowCopy(nz.bits.data, input) nz.bits.bitpointer = 0 nz.bits.databitlen = input.len * 8 nz.mode = nzsInflate