←back to thread

12 points ozgrakkurt | 1 comments | | HN request time: 0s | source
Show context
gus_massa ◴[] No.46109019[source]
Sorry for asking, but there are too many weird project in this field. Can compressed_size be bigger than input.len?
replies(1): >>46117765 #
ozgrakkurt ◴[] No.46117765[source]
Yes 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.

replies(1): >>46142758 #
1. wiml ◴[] No.46142758[source]
I'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.