enzoh / go-revolver

A decentralized peer-to-peer broadcast network.
https://dfinity.org
49 stars 12 forks source link

Reuse artifact buffers #5

Open derekchiang opened 7 years ago

derekchiang commented 7 years ago

In networked systems that need access to fixed-size buffers, it's common to use a buffer pool to minimize allocation and relieve GC pressure. Go has sync.Pool that's good for this purpose. It could be an over-optimization though since it's unclear if any peer would ever allocate buffers fast enough that memory actually becomes an issue.

derekchiang commented 7 years ago

I was looking at this code for instance.