]> Cypherpunks repositories - gostls13.git/commitdiff
net/netip: use strconv.AppendUint in AddrPort.AppendTo
authorTobias Klauser <tklauser@distanz.ch>
Wed, 4 May 2022 07:20:56 +0000 (09:20 +0200)
committerGopher Robot <gobot@golang.org>
Wed, 4 May 2022 18:54:31 +0000 (18:54 +0000)
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 <iant@google.com>
Run-TryBot: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: David Chase <drchase@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
src/net/netip/netip.go

index 7d8b20384e746f91adf20a5222c6822ceb0ad8d1..2c21715af1098b147312e00bd33d11a14ad34500 100644 (file)
@@ -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
 }