Partial flush in LZMA SDK

2010-03-19
2014-05-14
  • Gilles Vollant
    Gilles Vollant
    2010-03-19

    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?

     
  • Igor Pavlov
    Igor Pavlov
    2010-03-20

    You can try LZMA2 from XZ Utils
    http://tukaani.org/xz/

     
  • Gilles Vollant
    Gilles Vollant
    2014-05-08

    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
  • Igor Pavlov
    Igor Pavlov
    2014-05-09

    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.

     
  • Gilles Vollant
    Gilles Vollant
    2014-05-13

    I'm sure. I made several test (with apple xcode/LLVM and Visual studio 2013), and always compare same compiler, and same file.

     
  • Igor Pavlov
    Igor Pavlov
    2014-05-14

    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.