go-bitswap
go-bitswap copied to clipboard
Improve (CPU) performance when rebroadcasting wants
When we can't find anything for a while, we add all outstanding wants to a "broadcast" wantlist. Unfortunately, we repeatedly do this. Fortunately, we don't re-send "want" messages but repeatedly adding all idle wants to every peer's wantlist incurs a high CPU cost.
We've partially fixed this in #133 by doing this less frequently but we can do better.
- If it's already in the broadcast wantlist, don't bother "sending" the message.
- Only add new idle wants? Extra state we need to track but may be worth it.
Can confirm that this is still an issue under heavy load.