[PATCH] D121512: [Support] zlib::compress: replace compress2 with iterative deflate

Joerg Sonnenberger via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Mar 12 13:23:00 PST 2022


joerg added a comment.

`compressBound` gives the maximum possible size for the output, so of course it can be larger than the input. In combination with `resize_for_overwrite`, that should be cheaper than possible multiple copies for the loop if there is even a slight chance that the data doesn't compress that well. The code complexity is certainly much higher. The only expected error from `compress2`  here is `Z_MEM_ERROR` when it can't allocate the dictionary etc. As such, we could convert that one into a fatal error easily.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121512/new/

https://reviews.llvm.org/D121512



More information about the llvm-commits mailing list