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

- fixing memory leak and performance #521 #522

Merged
merged 2 commits into from
Sep 25, 2018

Conversation

rhajek
Copy link
Contributor

@rhajek rhajek commented Sep 17, 2018

Fixing #521
ThreadLocal StringBuilder hashmap cache was replaced by simple ThreadLocal StringBuilder.

escapeKey(sb, measurement);
concatenatedTags(sb);
concatenatedFields(sb);
if (precision != null) {
Copy link
Contributor

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);
Copy link
Contributor

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();
Copy link
Contributor

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-io
Copy link

codecov-io commented Sep 21, 2018

Codecov Report

Merging #522 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/influxdb/dto/Point.java 83.12% <100%> (-0.4%) 34 <6> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ca4173...fd729f6. Read the comment docs.

@fmachado fmachado merged commit 8e5f235 into influxdata:master Sep 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants