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

kad: Store peers in btreemap for kbuckets #335

Open
lexnv opened this issue Feb 27, 2025 · 0 comments
Open

kad: Store peers in btreemap for kbuckets #335

lexnv opened this issue Feb 27, 2025 · 0 comments
Labels
priority: low Nice-to-have improvements, optimizations, or future considerations todo Extracted from code todos

Comments

@lexnv
Copy link
Collaborator

lexnv commented Feb 27, 2025

At the moment, we store the peers of a k-bucket in a vector.

Investigate if storing peers in a BTreeMap in ascending order of their distance from local key would bring any benefit performance-wise. Considering that we need to sort the records on closest_iter depending on the target key, I would lean towards not having to pay for the performance hit of BTreeMap, would be good to have a second look.

pub struct KBucket {
// TODO: store peers in a btreemap with increasing distance from local key?
nodes: Vec<KademliaPeer>,
}

@lexnv lexnv added priority: low Nice-to-have improvements, optimizations, or future considerations todo Extracted from code todos labels Feb 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low Nice-to-have improvements, optimizations, or future considerations todo Extracted from code todos
Projects
None yet
Development

No branches or pull requests

1 participant