mirror of
https://github.com/tailscale/tailscale.git
synced 2025-12-03 02:21:58 +00:00
wgengine/magicsock: remove final alloc from ReceiveFrom
And now that we don't have to play escape analysis and inlining games, simplify the code. Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
committed by
Josh Bleecher Snyder
parent
463728a885
commit
1b57b0380d
@@ -1345,14 +1345,18 @@ func TestReceiveFromAllocs(t *testing.T) {
|
||||
}
|
||||
// Go 1.16 and before: allow 3 allocs.
|
||||
// Go 1.17: allow 2 allocs.
|
||||
// Go Tailscale fork, Go 1.18+: allow 1 alloc.
|
||||
// Go 1.17, Tailscale fork: allow 1 alloc.
|
||||
// Go 1.18+: allow 0 allocs.
|
||||
// Go 2.0: allow -1 allocs (projected).
|
||||
major, ts := goMajorVersion(runtime.Version())
|
||||
maxAllocs := 3
|
||||
switch {
|
||||
case major == 17:
|
||||
case major == 17 && !ts:
|
||||
maxAllocs = 2
|
||||
case major >= 18, ts:
|
||||
case major == 17 && ts:
|
||||
maxAllocs = 1
|
||||
case major >= 18:
|
||||
maxAllocs = 0
|
||||
}
|
||||
t.Logf("allowing %d allocs for Go version %q", maxAllocs, runtime.Version())
|
||||
roundTrip := setUpReceiveFrom(t)
|
||||
|
||||
Reference in New Issue
Block a user