-
Notifications
You must be signed in to change notification settings - Fork 478
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
- fixing memory leak and performance #521 #522
Conversation
escapeKey(sb, measurement); | ||
concatenatedTags(sb); | ||
concatenatedFields(sb); | ||
if (precision != null) { |
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.
This check is not necessary. formatedTime
is already doing it.
.computeIfAbsent(this.measurement, MeasurementStringBuilder::new) | ||
.resetForUse(); | ||
final StringBuilder sb = CACHED_STRINGBUILDERS.get(); | ||
sb.setLength(0); |
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.
Just to be kind to the next developer who wonder why we do this here, I would add a comment explaining our intention.
.get() | ||
.computeIfAbsent(this.measurement, MeasurementStringBuilder::new) | ||
.resetForUse(); | ||
final StringBuilder sb = CACHED_STRINGBUILDERS.get(); |
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.
IMO declaring variables as final if they are (1) only visible inside a method and (2) not strictly required to be final only bloats the code.
Codecov Report
@@ Coverage Diff @@
## master #522 +/- ##
============================================
+ Coverage 87.97% 87.98% +<.01%
Complexity 380 380
============================================
Files 25 25
Lines 1547 1531 -16
Branches 172 173 +1
============================================
- Hits 1361 1347 -14
Misses 120 120
+ Partials 66 64 -2
Continue to review full report at Codecov.
|
Fixing #521
ThreadLocal StringBuilder hashmap cache was replaced by simple ThreadLocal StringBuilder.