]> git.ipfire.org Git - thirdparty/zstd.git/commit
Split block compresser out of long range matcher
authorNick Terrell <terrelln@fb.com>
Wed, 21 Feb 2018 03:34:43 +0000 (19:34 -0800)
committerNick Terrell <terrelln@fb.com>
Thu, 22 Feb 2018 23:18:41 +0000 (15:18 -0800)
commitaf866b3a5854aa7a22853b8a2e545e2d61dfa6c3
tree766a16f5732dc79d96b47ade645330c5b1016ee5
parent4d6632c8f3f1049ee249621dc0587323de1e32f4
Split block compresser out of long range matcher

* `ZSTD_ldm_generateSequences()` generates the LDM sequences and
  stores them in a table. It should work with any chunk size, but
  is currently only called one block at a time.
* `ZSTD_ldm_blockCompress()` emits the pre-defined sequences, and
  instead of encoding the literals directly, it passes them to a
  secondary block compressor. The code to handle chunk sizes greater
  than the block size is currently commented out, since it is unused.
  The next PR will uncomment exercise this code.
* During optimal parsing, ensure LDM `minMatchLength` is at least
  `targetLength`. Also don't emit repcode matches in the LDM block
  compressor. Enabling the LDM with the optimal parser now actually improves
  the compression ratio.
* The compression ratio is very similar to before. It is very slightly
  different, because the repcode handling is slightly different. If I remove
  immediate repcode checking in both branches the compressed size is exactly
  the same.
* The speed looks to be the same or better than before.

Up Next (in a separate PR)
--------------------------

Allow sequence generation to happen prior to compression, and produce more
than a block worth of sequences. Expose some API for zstdmt to consume.
This will test out some currently untested code in
`ZSTD_ldm_blockCompress()`.
lib/common/zstd_internal.h
lib/compress/zstd_compress.c
lib/compress/zstd_compress_internal.h
lib/compress/zstd_ldm.c
lib/compress/zstd_ldm.h