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

[memory opt] Downsize decompression buffers when large for too long #2069

Merged
merged 8 commits into from
Apr 6, 2020

Conversation

bimbashrestha
Copy link
Contributor

@terrelln
Copy link
Contributor

terrelln commented Apr 3, 2020

Please add a test, you should be able to use ZSTD_sizeof_DCtx() to test it.

Copy link
Contributor

@felixhandte felixhandte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good overall. Suggestions inline.

lib/decompress/zstd_decompress.c Outdated Show resolved Hide resolved
lib/decompress/zstd_decompress.c Outdated Show resolved Hide resolved
lib/decompress/zstd_decompress.c Show resolved Hide resolved
lib/decompress/zstd_decompress_internal.h Outdated Show resolved Hide resolved
lib/decompress/zstd_decompress.c Outdated Show resolved Hide resolved
lib/decompress/zstd_decompress.c Outdated Show resolved Hide resolved
lib/decompress/zstd_decompress_internal.h Outdated Show resolved Hide resolved
@Cyan4973
Copy link
Contributor

Cyan4973 commented Apr 3, 2020

Looks good to me. It's a clean patch, great work @bimbashrestha !
I believe the only remaining comment is from @terrelln , about a need to add a test to ensure the downsizing happens as expected (there is already such a test for CCtx, it could be extended to also cover DCtx).

And just FYI, since I did not participate on earlier discussion on this topic, I was not opposed on having separate constants for compression and decompression states, since it would allow differentiated policy if need be. But indeed, the names of constants should reflect their respective scope.

That being said, there's no urgency. We can start by using the same constants and therefore same policy for both DCtx and CCtx. We can always add new specific constants later if the need arises.

Copy link
Contributor

@terrelln terrelln left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM once the test is added.

@bimbashrestha bimbashrestha merged commit 2847d1a into facebook:dev Apr 6, 2020
@Cyan4973 Cyan4973 mentioned this pull request May 21, 2020
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.

5 participants