]> Cypherpunks repositories - gostls13.git/commit
time: optimize GoString
authorAmarjeet Anand <amarjeetanandsingh@gmail.com>
Sat, 13 Aug 2022 16:30:33 +0000 (22:00 +0530)
committerGopher Robot <gobot@golang.org>
Wed, 17 Aug 2022 04:10:17 +0000 (04:10 +0000)
commit2c46cc8b8997f4f5cdb7766e4e2bdf8e57f67c76
treec6929f2fba2a16625374f5f3c661b8f6ccbb37ec
parentc411886c753dc85c23d06953b9a2e20e4ec1731f
time: optimize GoString

Optimize Time.GoString by avoiding multiple calls to absDate.

name        old time/op    new time/op    delta
GoString-8     313ns ± 2%     197ns ± 1%  -37.08%  (p=0.008 n=5+5)

name        old alloc/op   new alloc/op   delta
GoString-8     80.0B ± 0%     80.0B ± 0%     ~     (all equal)

name        old allocs/op  new allocs/op  delta
GoString-8      1.00 ± 0%      1.00 ± 0%     ~     (all equal)

Fixes #54436

Change-Id: I8e6f8e7bbb9857b4bc0cdf6ed29a6b2415775db7
Reviewed-on: https://go-review.googlesource.com/c/go/+/423634
Run-TryBot: Joseph Tsai <joetsai@digital-static.net>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Joseph Tsai <joetsai@digital-static.net>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Run-TryBot: Ian Lance Taylor <iant@google.com>
src/time/format.go
src/time/time_test.go