inikep / lizard

Lizard (formerly LZ5) is an efficient compressor with very fast decompression. It achieves compression ratio that is comparable to zip/zlib and zstd/brotli (at low and medium compression levels) at decompression speed of 1000 MB/s and faster.
Other
644 stars 40 forks source link

LZ5v2: Levels are a bit confusing. #8

Closed xcrh closed 7 years ago

xcrh commented 7 years ago

As of 1.5 RC (9e8d558d81e958407edf676329972174e0c9b0de) levels are somewhat confusing.

Normally when app-level dev calls library, it is expected higher level gives better ratio at cost of slower compression speed. Builtin help of LZ5 also suggests it is a case:

-1...-18 : compression level; higher number == more compression but slower

However, it isn't like this in LZ5 v2:

$ ./lz5 -b9 lz5 9#lz5 : 192320 -> 102547 (1.875), 1.2 MB/s , 404.0 MB/s

$ ./lz5 -b10 lz5 10#lz5 : 192320 -> 113877 (1.689), 11.1 MB/s , 358.8 MB/s

So increasing level from 9 to 10 quite unxepectedly boosts compression speed and drops ratio.

I guess either levels may need to be fine-tuned to behave like expected or, maybe, devs should get explicit knowledge these are 2 different sub-algos, not sure which option is better.

inikep commented 7 years ago

The issue here is that these are 2 independent algorithms:

I didn't want to use a convention -a1 -9 (algorithm 1; level 9) in lz5.exe and an additional param for API.

m^2 suggested: having levels 11-19 and 21-29. I think it would make it clearer that these are two different codecs.

inikep commented 7 years ago

Levels are changed in LZ5 v2.0 RC2: https://github.com/inikep/lz5/releases/tag/v2.0rc2