Skip to content

Conversation

@sisong
Copy link

@sisong sisong commented Aug 7, 2024

for decompressor

Added several lower-level APIs with little as possible source code changes, to support decompress block by block;
And updated the gzip cmdline with new APIs, the memory usage when decompress will be greatly reduced, usually <1MB!
Also, because it needs to support any .gz format (not just libdeflate), the decompress buffer will automatically adjust the size to fit the input maximum block size.

Because decompressor reused a small memory, the CPU cache hit ratio will be greatly improved, resulting in an increase in decompress speed;
In my multiple test cases, it was able to get 20%--50% faster.

for compressor

Added several lower-level APIs with minor source code changes, to support compress block by block;
And updated the gzip cmdline by new APIs, the memory usage when compress will be greatly reduced;
The memory requires is related to the block size set and compress level, not related to input file size; when the block size is 2 MB and compress level is 12, the memory usage ~ 13 MB.
These new APIs can be used for multi-threaded parallel compression, and there is almost no loss of compress ratio.


( I used libdeflate for my multiple actual projects and make a lot of feature changes; Hopefully commit some useful changes back to libdeflate. )

@sisong sisong changed the title support decompress by stream(block by block) support compress & decompress by stream(block by block) Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants