go/src/time
korzhao d2f002cb39 time/format: avoid growslice in time.String()/time.GoString()
Pre-allocate the slice of buf with enough capacity
to avoid growslice calls.

benchmark                   old ns/op     new ns/op     delta
BenchmarkTimeString-4       493           409           -17.12%
BenchmarkTimeGoString-4     309           182           -41.30%

benchmark                   old allocs     new allocs     delta
BenchmarkTimeString-4       5              3              -40.00%
BenchmarkTimeGoString-4     4              1              -75.00%

benchmark                   old bytes     new bytes     delta
BenchmarkTimeString-4       152           128           -15.79%
BenchmarkTimeGoString-4     248           80            -67.74%

Change-Id: I64eabe2ab0b3d4a846453c2e8e548a831d720b8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/343971
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
Trust: Alexander Rakoczy <alex@golang.org>
2021-08-25 18:27:41 +00:00
..
testdata time: move slim test tzdata to testdata directory 2021-04-14 19:38:36 +00:00
tzdata time/tzdata: update links in comment 2021-08-15 00:19:34 +00:00
embed.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
example_test.go
export_android_test.go
export_test.go time: properly quote strings containing quotes and backslashes 2021-04-06 19:18:47 +00:00
export_windows_test.go
format.go time/format: avoid growslice in time.String()/time.GoString() 2021-08-25 18:27:41 +00:00
format_test.go time: make time.Time print a valid Go string with %#v 2021-05-02 20:59:26 +00:00
genzabbrs.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
internal_test.go time: check int64 overflow in Time.addSec 2021-03-17 19:48:52 +00:00
mono_test.go
sleep.go time: update current time comment 2021-08-16 17:24:37 +00:00
sleep_test.go runtime: don't clear timerModifiedEarliest if adjustTimers is 0 2021-07-22 19:26:40 +00:00
sys_plan9.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
sys_unix.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
sys_windows.go
tick.go time: update current time comment 2021-08-16 17:24:37 +00:00
tick_test.go time: increase slop for TestTicker 2021-04-27 19:37:31 +00:00
time.go time: correct typo in documentation for UnixMicro 2021-07-19 21:56:09 +00:00
time_test.go time: handle invalid UTF-8 byte sequences in quote to prevent panic 2021-06-24 03:20:33 +00:00
tzdata_test.go
zoneinfo.go time: add Time.IsDST() to check if its Location is in Daylight Savings Time 2021-03-15 23:56:07 +00:00
zoneinfo_abbrs_windows.go
zoneinfo_android.go
zoneinfo_android_test.go
zoneinfo_ios.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
zoneinfo_js.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
zoneinfo_plan9.go
zoneinfo_read.go time: use offset and isDST when caching zone from extend string 2021-04-05 18:52:42 +00:00
zoneinfo_test.go time: add missing "os" import to zoneinfo_test.go 2021-04-15 00:40:43 +00:00
zoneinfo_unix.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
zoneinfo_unix_test.go all: go fmt std cmd (but revert vendor) 2021-02-20 03:54:50 +00:00
zoneinfo_windows.go
zoneinfo_windows_test.go