The Hash method on wire messages unfortunately involves allocations, so it's generally best to keep the result as a local and use that local through to avoid more allocs.
Also, since fmt.Errorf involves interfaces, taking the address of the local session id forces it to the heap. It's faster to copy it into the interface instead and avoid the GC hit.
The
Hash
method onwire
messages unfortunately involves allocations, so it's generally best to keep the result as a local and use that local through to avoid more allocs.Also, since
fmt.Errorf
involves interfaces, taking the address of the local session id forces it to the heap. It's faster to copy it into the interface instead and avoid the GC hit.