libp2p / js-libp2p

The JavaScript Implementation of libp2p networking stack.
https://libp2p.io
Other
2.27k stars 436 forks source link

fix: use prefix binary tree for routing table #2536

Closed achingbrain closed 2 months ago

achingbrain commented 2 months ago

The Kademlia paper shows a simple binary tree as a data structure for the routing table. This can grow very deep for long keys so an optimisation is to only use a prefix of the KAD-ID when constructing the table.

This results in faster lookups for better performance.

Change checklist