3 ms·
Sorry for asking, but there are too many weird project in this field. Can compressed_size be bigger than input.len?
by gus_massa 11mo ago
Sorry for asking, but there are too many weird project in this field. Can compressed_size be bigger than input.len?
- ozgrakkurt 11mo agoYes because you have to have some metadata that describes how to decompress the compressed data. This is the case in all compression algorithms I know. As an example Lz4 and zstd also have a compressBound() function that calculates this.
- wiml 11mo agoI'm pretty sure it's the case in all compression algorithms, period — if you make some inputs smaller, you have to make other inputs larger. There's a pigeonhole style argument for it. The trick of course is to make the inputs you expect to actually encounter smaller, ideally while enlarging other inputs as little as possible.