probe-lab / zikade

A Go implementation of the libp2p Kademlia DHT specification
Other
10 stars 3 forks source link

Optimize reading libp2p messages with sync.Pool buffers #23

Open guillaumemichel opened 1 year ago

guillaumemichel commented 1 year ago

the libp2p endpoint doesn't yet make use of sync.Pool to optimize memory allocations when writing/reading messages to/from a libp2p stream. This seems to be an easy performance improvement.

go-libp2p-kad-dht is using sync.Pool (see https://github.com/libp2p/go-libp2p-kad-dht/blob/978cb74f5fdf846e09d5769bb4dfb9f962135c38/internal/net/message_manager.go#L360-L368)

References

https://github.com/plprobelab/go-kademlia/blob/main/network/endpoint/libp2pendpoint/libp2pendpoint.go

iand commented 1 year ago

Will move issue to go-libp2p-kad-dht for KadDHT in v2