Optimise Format for the most frequently used RFC3339
and RFC3339Nano layouts by avoiding parsing of layout.
> benchstat oldBench.txt newBench.txt
name old time/op new time/op delta
FormatRFC3339-8 302ns ± 1% 203ns ± 0% -32.89% (p=0.016 n=5+4)
FormatRFC3339Nano-8 337ns ± 1% 219ns ± 1% -34.91% (p=0.008 n=5+5)
name old alloc/op new alloc/op delta
FormatRFC3339-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
FormatRFC3339Nano-8 32.0B ± 0% 32.0B ± 0% ~ (all equal)
name old allocs/op new allocs/op delta
FormatRFC3339-8 1.00 ± 0% 1.00 ± 0% ~ (all equal)
FormatRFC3339Nano-8 1.00 ± 0% 1.00 ± 0% ~ (all equal)
Fixes #54093
Change-Id: Ifc84fce6078e24514ecbcd234875bca4aaab5e0e
Reviewed-on: https://go-review.googlesource.com/c/go/+/421877
Run-TryBot: Ian Lance Taylor <iant@google.com>
Auto-Submit: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>