Optimize reading libp2p messages with sync.Pool buffers
guillaumemichel opened this issue · comments
Guillaume Michel commented
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
Ian Davis commented
Will move issue to go-libp2p-kad-dht for KadDHT in v2