deflate: Move advanced compression state#107
Merged
Conversation
Only allocate advanced compression state when actually needed. This will reduce upfront allocations for levels < 5 significantly.
# Conflicts: # compressible_test.go
|
Was this change reverted? These are the results I'm getting on master: Much higher than those reported in this PR. I had similar results testing on my linux VM. |
Owner
Author
|
@nhooyr This PR is about static allocations (allocations kept in the writer between writes/resets), though this seems rather high. Could you share the benchmark code? |
|
It's the same benchmark in this PR. Line 243 in 5e801bf |
Owner
Author
|
Ah, thanks :) |
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Only allocate advanced compression state when actually needed.
This will reduce upfront allocations for levels < 5 significantly (reduced by approximately 750K)
Much less risk than #70 - but not as clean.
Of course this is only relevant when
Reset()is not used.Benchmark: https://gist.github.com/klauspost/f5df3a3522ac4bcb3bcde448872dffe6
Before:
After: