This repository was archived by the owner on Dec 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 765
optimize: release allocated ByteBuffer explicitly #1375
Merged
Merged
Conversation
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
45e1063 to
c37d86b
Compare
daf9f17 to
77b1d60
Compare
Member
Author
|
@starnop PTAL |
Codecov Report
@@ Coverage Diff @@
## master #1375 +/- ##
==========================================
+ Coverage 52.02% 52.22% +0.20%
==========================================
Files 137 139 +2
Lines 9108 9181 +73
==========================================
+ Hits 4738 4795 +57
- Misses 3987 4001 +14
- Partials 383 385 +2
Continue to review full report at Codecov.
|
44a5afc to
7b3d5f8
Compare
use sync.Pool to manager the bytes.Buffer and bufio.Writer to minimizing the memory allocation and usage Signed-off-by: lowzj <[email protected]>
Contributor
|
LGTM. |
lowzj
added a commit
that referenced
this pull request
Jul 2, 2020
optimize: release allocated ByteBuffer explicitly
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Signed-off-by: lowzj [email protected]
Ⅰ. Describe what this PR did
This pull request uses
sync.Poolto manager thebytes.Bufferandbufio.Writerto minimizing the memory allocation and usage.Here is a comparison when downloading a 10GB file.
before:
after:
Ⅱ. Does this pull request fix one issue?
fixes: #1206
Ⅲ. Why don't you add test cases (unit test/integration test)? (你真的觉得不需要加测试吗?)
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews