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

Optimize Point.lineProtocol() #336

Conversation

bentatham
Copy link
Contributor

While testing high throughput, I profiled the sender, and discovered it was creating a new NumberFormat for every point, whether or not it actually ever needed it. I've changed it to use a ThreadLocal of it (since NumberFormat is not thread-safe), and to reuse the same instance. I've also changed it to use a single StringBuilder rather than returning strings (built by additional instances) and appending them together.

@bentatham bentatham force-pushed the feature/optimize-point-lineprotocol branch from 8dbdc19 to 07e9102 Compare June 12, 2017 18:04
@codecov-io
Copy link

Codecov Report

Merging #336 into master will decrease coverage by 0.11%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #336      +/-   ##
============================================
- Coverage     79.33%   79.22%   -0.12%     
- Complexity      137      138       +1     
============================================
  Files            11       11              
  Lines           726      722       -4     
  Branches         79       78       -1     
============================================
- Hits            576      572       -4     
  Misses          109      109              
  Partials         41       41
Impacted Files Coverage Δ Complexity Δ
src/main/java/org/influxdb/dto/Point.java 82.87% <100%> (-0.46%) 25 <1> (+1)

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 e88a882...07e9102. Read the comment docs.

@majst01
Copy link
Collaborator

majst01 commented Jun 12, 2017

Hi,

i think this is duplicate of #330, which will be merged soon.

@bentatham
Copy link
Contributor Author

lol -- so it is - nice to know that two of us got to some very similar optimizations independently.

@bentatham bentatham closed this Jun 12, 2017
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