Re:Simple techniques to optimise Go programs
by stebalien on Tuesday June 18, 2019 @04:29PM
(#20218050)
Unfortunately, that's still wrong (I think). Go will still allocate a temporary slice-header on the heap and then de-allocate it when it's dereferenced.
I believe the only way to do this without unsafe code is to pool these slice-headers as in https://github.com/libp2p/go-buffer-pool/blob/master/pool.go.