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

Implement nth method for scylla::transport::locator::ReplicaSetIterator more efficiently #674

Open
havaker opened this issue Mar 22, 2023 · 0 comments
Labels
area/load-balancing performance Improves performance of existing features
Milestone

Comments

@havaker
Copy link
Contributor

havaker commented Mar 22, 2023

Manual implementation for ChainedNTS variant would be more efficient than just skipping nodes via .next() (#612 (comment)).

fn nth(&mut self, n: usize) -> Option<Self::Item> {
match &mut self.inner {
ReplicaSetIteratorInner::Plain { replicas: _, idx } => {
*idx += n;
self.next()
}
_ => {
for _i in 0..n {
self.next()?;
}
self.next()
}
}
}

@havaker havaker changed the title Implement nth method for scylla::locator::ReplicaSetIterator more efficiently Implement nth method for scylla::transport::locator::ReplicaSetIterator more efficiently Mar 22, 2023
@piodul piodul added area/load-balancing performance Improves performance of existing features labels Mar 23, 2023
@piodul piodul added this to the 1.1.0 milestone Mar 28, 2023
@Lorak-mmk Lorak-mmk self-assigned this Nov 15, 2023
@Lorak-mmk Lorak-mmk removed their assignment Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/load-balancing performance Improves performance of existing features
Projects
None yet
Development

No branches or pull requests

3 participants