diff --git a/zlibWrapper/Makefile b/zlibWrapper/Makefile index 42a8d32d5..69c976fa5 100644 --- a/zlibWrapper/Makefile +++ b/zlibWrapper/Makefile @@ -32,7 +32,7 @@ test: example fitblk example_zstd fitblk_zstd zwrapbench ./fitblk_zstd 10240 <../zstd_compression_format.md ./fitblk_zstd 40960 <../zstd_compression_format.md ./zwrapbench -qb3B1K ../zstd_compression_format.md - ./zwrapbench -qb1e5r ../lib ../programs ../tests + ./zwrapbench -rqb1e5 ../lib ../programs ../tests #valgrindTest: ZSTDLIBRARY = $(ZSTDLIBDIR)/libzstd.so valgrindTest: VALGRIND = LD_LIBRARY_PATH=$(ZSTDLIBDIR) valgrind --track-origins=yes --leak-check=full --error-exitcode=1 @@ -45,7 +45,7 @@ valgrindTest: clean example fitblk example_zstd fitblk_zstd zwrapbench $(VALGRIND) ./fitblk_zstd 10240 <../zstd_compression_format.md $(VALGRIND) ./fitblk_zstd 40960 <../zstd_compression_format.md $(VALGRIND) ./zwrapbench -qb3B1K ../zstd_compression_format.md - $(VALGRIND) ./zwrapbench -qb1e5 ../lib ../programs ../tests + $(VALGRIND) ./zwrapbench -rqb1e5 ../lib ../programs ../tests .c.o: $(CC) $(CFLAGS) -c -o $@ $< diff --git a/zlibWrapper/README.md b/zlibWrapper/README.md index a3d161f27..163009a8b 100644 --- a/zlibWrapper/README.md +++ b/zlibWrapper/README.md @@ -102,7 +102,7 @@ The speed of compression can be improved with reusing a single context with foll - free the context with `deflateEnd` To check the difference we made experiments using `zwrapbench -ri6b6` with zstd and zlib compression (both at level 6). -The input data was decompressed git repository downloaded from https://github.com/git/git/archive/master.zip that contains 2979 files. +The input data was decompressed git repository downloaded from https://github.com/git/git/archive/master.zip which contains 2979 files. The table below shows that reusing contexts has a minor influence on zlib but it gives improvement for zstd. In our example (the last 2 lines) it gives 4% better compression speed and 5% better decompression speed. diff --git a/zlibWrapper/zstd_zlibwrapper.c b/zlibWrapper/zstd_zlibwrapper.c index 524ca7868..3464c600d 100644 --- a/zlibWrapper/zstd_zlibwrapper.c +++ b/zlibWrapper/zstd_zlibwrapper.c @@ -260,7 +260,7 @@ ZEXTERN int ZEXPORT z_deflate OF((z_streamp strm, int flush)) if (zwc->zbc == NULL) { int res; zwc->zbc = ZSTD_createCStream_advanced(zwc->customMem); - if (zwc->zbc == NULL) return ZWRAPC_finishWithError(zwc, strm, res); + if (zwc->zbc == NULL) return ZWRAPC_finishWithError(zwc, strm, 0); res = ZWRAP_initializeCStream(zwc, NULL, 0, (flush == Z_FINISH) ? strm->avail_in : 0); if (res != Z_OK) return ZWRAPC_finishWithError(zwc, strm, res); } else {