Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lazy parameters adaptation - buffered mode #3029

Draft
wants to merge 2 commits into
base: dev
Choose a base branch
from
Draft

Conversation

Cyan4973
Copy link
Contributor

@Cyan4973 Cyan4973 commented Jan 25, 2022

This is a follow up to #2974, which was limited to ZSTD_stableInBuffer mode.

In this PR, input data is just buffered, until a full block is reached, or a flush() or end() order arrives.
This makes it possible to do late parameters adaptation when input is smaller than a full block, which is especially important for very small data, in order to use less resource and more appropriate parameters.
This (generally) results in better compression ratio, and also better speed, especially for newly allocated contexts, and as such can be seen as a follow up to #2969.

This proposal uses an additional buffer to buffer the first block before context initialization.
The issue with this proposal is that it's not compatible with initStatic.
Using the existing context for buffering would be another possibility, but it's more complex to do when the context doesn't exist, or is too small. And there is also the tricky topic of transferring data from the old to the new context at initialization time, which is especially dangerous when they are overlapping, which happens with initStatic, and will likely require some dedicated code. So there is some balance to find with complexity.

Anyway, this PR is at least good enough to start a discussion.

for small data in streaming mode.

Limitation : only for contexts with dynamic allocation (default or custom).
InitStatic is excluded, and will require a dedicated diff.
parameters adaptation not only help speed,
it also helps compression ratio.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants