-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
consoleEncoder: put cloned jsonEncoder back to pool #852
Conversation
bb9aed3
to
6b618ff
Compare
Codecov Report
@@ Coverage Diff @@
## master #852 +/- ##
=======================================
Coverage 98.35% 98.35%
=======================================
Files 43 43
Lines 2368 2371 +3
=======================================
+ Hits 2329 2332 +3
Misses 32 32
Partials 7 7
Continue to review full report at Codecov.
|
consoleEncoder clone a jsonEncoder in `writeContext`, but never put back to pool after use. This make zap do more memory allocations, and may increase gc time.
6b618ff
to
4b59b9c
Compare
Co-authored-by: Prashant Varanasi <github@prashantv.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the contribution @wyxloading!
consoleEncoder clone a jsonEncoder in `writeContext`, but never put back to pool after use. This make zap do more memory allocations, and may increase gc time.
This PR put back the cloned
jsonEncoder
inconsoleEncoder
to_jsonPool
as mentioned in #851Tested and got no errors ( with race detector )
make test
go test -race -run="^$$" -bench="BenchmarkZapConsole" ./zapcore