]> Cypherpunks repositories - gostls13.git/commit
time: optimize quote using byte(c) for ASCII
author1911860538 <alxps1911@gmail.com>
Thu, 13 Mar 2025 11:57:51 +0000 (11:57 +0000)
committerGopher Robot <gobot@golang.org>
Fri, 14 Mar 2025 22:08:20 +0000 (15:08 -0700)
commit853b514417dab2cf0383e48207caff2ce0305618
treef609e3e2062083c555c9025d6e7e33ef7a7d67fb
parentc1c7e5902fda622d5d5870ed045407a9acd5666b
time: optimize quote using byte(c) for ASCII

Since c < runeSelf && c >= ' ' (i.e., 32 <= c < 128), using buf = append(buf, byte(c)) instead of buf = append(buf, string(c)...) is a better choice, as it provides better performance.

Change-Id: Ic0ab25c71634a1814267f4d85be2ebd8a3d44676
GitHub-Last-Rev: 5445b547712bbfc77a5c17d76194291c22eb4a05
GitHub-Pull-Request: golang/go#72820
Reviewed-on: https://go-review.googlesource.com/c/go/+/657055
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
src/time/format.go