Skip to content

cache: implement binary search for ringBuffer range iterations#20498

Closed
apullo777 wants to merge 1 commit intoetcd-io:mainfrom
apullo777:ringbuffer-binary-search
Closed

cache: implement binary search for ringBuffer range iterations#20498
apullo777 wants to merge 1 commit intoetcd-io:mainfrom
apullo777:ringbuffer-binary-search

Conversation

@apullo777
Copy link
Copy Markdown
Contributor

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

Open this PR to replace linear scan with binary search in ringBuffer pivot range operations
@serathius @MadhavJivrajani

@k8s-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: apullo777
Once this PR has been reviewed and has the lgtm label, please assign spzala for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link
Copy Markdown

Hi @apullo777. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Comment thread cache/ringbuffer.go
}

// findFirstGreaterOrEqualIndex returns first index with revision >= targetRev, or -1 if none.
func (r *ringBuffer[T]) findFirstGreaterOrEqualIndex(targetRev int64) int {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any performance improvement should be verified by accompanied benchmarks.

@serathius
Copy link
Copy Markdown
Member

/ok-to-test

@serathius
Copy link
Copy Markdown
Member

Do we have enough unit tests that cover all corner cases to fill safe optimizing here?

@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 15, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.22%. Comparing base (431a65a) to head (9ef7cef).
⚠️ Report is 378 commits behind head on main.

Additional details and impacted files

see 21 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #20498      +/-   ##
==========================================
+ Coverage   69.21%   69.22%   +0.01%     
==========================================
  Files         419      419              
  Lines       34745    34745              
==========================================
+ Hits        24049    24053       +4     
+ Misses       9300     9295       -5     
- Partials     1396     1397       +1     

Continue to review full report in Codecov by Sentry.

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@serathius
Copy link
Copy Markdown
Member

/retest

@serathius
Copy link
Copy Markdown
Member

Please rebase

Signed-off-by: Peter Chang <peter.yaochen.chang@gmail.com>
@github-actions
Copy link
Copy Markdown

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@github-actions github-actions Bot added the stale label Oct 26, 2025
@github-actions github-actions Bot closed this Nov 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants