Hello,
I'm evaluating the idea of converting some code which use zLib to LZMA SDK.
For decompress, no problem : LzmaDec_DecodeToBuf is a "zlib like" interface.
For compress, there is two point :
- lzma SDK use "one call" with callback. Using somes thread sync object, we can emulate the zlib interface
- but we sometime use the "Z_SYNC_FLUSH" parameter
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary, so
that the decompressor can get all input data available so far.
is it possible to emulate Z_SYNC_FLUSH with lzma sdk?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Like you suggest, three year later (2013), I used XZ Util to compress stream with zlib-like interface.
But I just discovered that decompression code from lzma sdk, with zlib-like interface (XzUnpacker_Create, XzUnpacker_Code,XzUnpacker_IsStreamWasFinished, XzUnpacker_Free) is between 12 and 16% faster than xzutil functions lzma_end and lzma_stream_decoder ...
Last edit: Gilles Vollant 2014-05-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've looked the code of lzma decoder in xz utils.
It uses another code scheme.
So it's possible that it can be faster or slower than the code from LZMA SDK.
LZMA decoder in LZMA SDK uses some tricks for fast decoding.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I'm evaluating the idea of converting some code which use zLib to LZMA SDK.
For decompress, no problem : LzmaDec_DecodeToBuf is a "zlib like" interface.
For compress, there is two point :
- lzma SDK use "one call" with callback. Using somes thread sync object, we can emulate the zlib interface
- but we sometime use the "Z_SYNC_FLUSH" parameter
If the parameter flush is set to Z_SYNC_FLUSH, all pending output is
flushed to the output buffer and the output is aligned on a byte boundary, so
that the decompressor can get all input data available so far.
is it possible to emulate Z_SYNC_FLUSH with lzma sdk?
You can try LZMA2 from XZ Utils
http://tukaani.org/xz/
Like you suggest, three year later (2013), I used XZ Util to compress stream with zlib-like interface.
But I just discovered that decompression code from lzma sdk, with zlib-like interface (XzUnpacker_Create, XzUnpacker_Code,XzUnpacker_IsStreamWasFinished, XzUnpacker_Free) is between 12 and 16% faster than xzutil functions lzma_end and lzma_stream_decoder ...
Last edit: Gilles Vollant 2014-05-08
I suppose LZMA SDK and XZ Utils must provide similar decompression speed.
So check again that you use same compiler and same data for test.
I'm sure. I made several test (with apple xcode/LLVM and Visual studio 2013), and always compare same compiler, and same file.
I've looked the code of lzma decoder in xz utils.
It uses another code scheme.
So it's possible that it can be faster or slower than the code from LZMA SDK.
LZMA decoder in LZMA SDK uses some tricks for fast decoding.