This issue was found by staticcheck.
Per https://staticcheck.io/docs/checks#SA6002, we must store in the pool
a pointer to the slice (instead of storing the slice directly) to avoid
extra allocations.
The send/receive benchmark shows we avoid 2 allocations:
name old time/op new time/op delta
SendRecvTCP-4 36.0µs ± 5% 36.4µs ± 2% ~ (p=0.548 n=5+5)
name old alloc/op new alloc/op delta
SendRecvTCP-4 5.37kB ± 5% 5.38kB ± 1% ~ (p=0.421 n=5+5)
name old allocs/op new allocs/op delta
SendRecvTCP-4 62.0 ± 0% 60.0 ± 0% -3.23% (p=0.008 n=5+5)
This issue was found by staticcheck. Per https://staticcheck.io/docs/checks#SA6002, we must store in the pool a pointer to the slice (instead of storing the slice directly) to avoid extra allocations.
The send/receive benchmark shows we avoid 2 allocations:
Signed-off-by: Fazlul Shahriar fshahriar@gmail.com