From: Tobias Klauser Date: Wed, 4 May 2022 07:20:56 +0000 (+0200) Subject: net/netip: use strconv.AppendUint in AddrPort.AppendTo X-Git-Tag: go1.19beta1~433 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=037b209ae3e0453004a4d57e152aa522c56f79e4;p=gostls13.git net/netip: use strconv.AppendUint in AddrPort.AppendTo This is already used in AddrPort.String. name old time/op new time/op delta AddrPortMarshalText/v4-4 67.9ns ± 3% 61.5ns ± 6% -9.43% (p=0.000 n=10+9) AddrPortMarshalText/v6-4 168ns ± 4% 155ns ± 2% -7.54% (p=0.000 n=10+10) AddrPortMarshalText/v6_ellipsis-4 169ns ± 3% 162ns ± 5% -4.03% (p=0.001 n=9+10) AddrPortMarshalText/v6_v4-4 87.0ns ± 4% 85.8ns ± 4% ~ (p=0.165 n=10+10) AddrPortMarshalText/v6_zone-4 169ns ± 3% 166ns ± 3% ~ (p=0.066 n=10+10) Change-Id: If16eda4bf48224029dcaf2069ae87f8d89865d99 Reviewed-on: https://go-review.googlesource.com/c/go/+/404014 Run-TryBot: Ian Lance Taylor Run-TryBot: Tobias Klauser Reviewed-by: David Chase TryBot-Result: Gopher Robot Auto-Submit: Ian Lance Taylor Reviewed-by: Bryan Mills Reviewed-by: Brad Fitzpatrick --- diff --git a/src/net/netip/netip.go b/src/net/netip/netip.go index 7d8b20384e..2c21715af1 100644 --- a/src/net/netip/netip.go +++ b/src/net/netip/netip.go @@ -1171,7 +1171,7 @@ func (p AddrPort) AppendTo(b []byte) []byte { b = append(b, ']') } b = append(b, ':') - b = strconv.AppendInt(b, int64(p.port), 10) + b = strconv.AppendUint(b, uint64(p.port), 10) return b }