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

Reduce allocations, improve readEntries performance by simplifying loop #8853

Merged
merged 4 commits into from
Sep 19, 2017

Conversation

stuartcarnie
Copy link
Contributor

@stuartcarnie stuartcarnie commented Sep 19, 2017

Reduce allocations, improve readEntries performance by simplifying loop

  • callers of ReadEntries and Key API can cache allocated slice
  • BlockIterator#Next allocations should be significantly reduced in real-world usage too
benchmark                                old ns/op     new ns/op     delta
BenchmarkIndirectIndex_Entries-8         13028         10439         -19.87%
BenchmarkIndirectIndex_ReadEntries-8     12905         7192          -44.27%
BenchmarkBlockIterator_Next-8            16374000      10879341      -33.56%

benchmark                                old allocs     new allocs     delta
BenchmarkIndirectIndex_Entries-8         1              1              +0.00%
BenchmarkIndirectIndex_ReadEntries-8     1              0              -100.00%
BenchmarkBlockIterator_Next-8            1001           2              -99.80%

benchmark                                old bytes     new bytes     delta
BenchmarkIndirectIndex_Entries-8         32768         32768         +0.00%
BenchmarkIndirectIndex_ReadEntries-8     32768         0             -100.00%
BenchmarkBlockIterator_Next-8            32768105      32896         -99.90%
Required for all non-trivial PRs
  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated

@stuartcarnie stuartcarnie changed the title Sgc readentries perf Reduce allocations, improve readEntries performance by simplifying loop Sep 19, 2017
Copy link
Contributor

@e-dard e-dard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@stuartcarnie stuartcarnie merged commit cf0a1d9 into master Sep 19, 2017
@stuartcarnie stuartcarnie deleted the sgc-readentries-perf branch September 19, 2017 20:28
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