Re:Practices for writing high-performance Go
by kevinconaway on Monday May 06, 2019 @11:08AM
(#19840108)
There is sync.Pool [0] but I wouldn't reach for it until you've profiled your application[1] and found that the specific allocation in question is a hot spot.
As of now[2], they get cleared when a GC occurs so they can be a bit quirky to use in practice. This behavior is changing though
As of now[2], they get cleared when a GC occurs so they can be a bit quirky to use in practice. This behavior is changing though
[0] https://golang.org/pkg/sync/#Pool
[1] https://blog.golang.org/profiling-go-programs
[2] https://github.com/golang/go/issues/22950