mirror of
https://github.com/golang/go
synced 2024-11-25 13:27:57 -07:00
a92c80eb40
Implement the encoding.TextAppender interface for "net.IP".
Implement the encoding.(Binary|Text)Appender interfaces for
"netip.Addr", "netip.AddrPort" and "netip.Prefix".
"net.IP.MarshalText" also gets some performance improvements:
│ old │ new │
│ sec/op │ sec/op vs base │
IPMarshalText/IPv4-8 66.06n ± 1% 14.55n ± 1% -77.97% (p=0.000 n=10)
IPMarshalText/IPv6-8 117.00n ± 1% 63.18n ± 1% -46.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8 137.8n ± 1% 111.3n ± 1% -19.27% (p=0.000 n=10)
geomean 102.1n 46.77n -54.21%
│ old │ new │
│ B/op │ B/op vs base │
IPMarshalText/IPv4-8 32.00 ± 0% 0.00 ± 0% -100.00% (p=0.000 n=10)
IPMarshalText/IPv6-8 48.00 ± 0% 0.00 ± 0% -100.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8 96.00 ± 0% 48.00 ± 0% -50.00% (p=0.000 n=10)
│ old │ new │
│ allocs/op │ allocs/op vs base │
IPMarshalText/IPv4-8 2.000 ± 0% 0.000 ± 0% -100.00% (p=0.000 n=10)
IPMarshalText/IPv6-8 2.000 ± 0% 0.000 ± 0% -100.00% (p=0.000 n=10)
IPMarshalText/IPv6_long-8 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10)
All exported types in the standard library that implement the
"encoding.(Binary|Text)Marshaler" now also implement the
"encoding.(Binary|Text)Appender".
Fixes #62384
Change-Id: I7d3da8c5736a1ab9c54b9ac4bd2fbf850f9d1bd0
GitHub-Last-Rev:
|
||
---|---|---|
.. | ||
6-stdlib | ||
1-intro.md | ||
2-language.md | ||
3-tools.md | ||
4-runtime.md | ||
5-toolchain.md | ||
7-ports.md |