Skip to content

Clone only needed KademliaPeers when yielding closest nodes #53

Open
@dmitry-markin

Description

The implementation of RoutingTable::closest calls KBucket::closest_iter, where all peers of a bucket are cloned:
https://github.com/altonen/litep2p/blob/365330d0b1ff96796b7ac0a78cec197f6e79ca7e/src/protocol/libp2p/kademlia/bucket.rs#L105

This can be optimized by sorting entries in place, yielding references, and cloning only KademliaPeers that are returned from RoutingTable::closest.

Metadata

Assignees

No one assigned

    Labels

    easyRequires little knowledge of the codebaseenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions