aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/string.go
diff options
context:
space:
mode:
authorYoulin Feng <fengyoulin@live.com>2025-08-30 17:18:10 +0800
committerGopher Robot <gobot@golang.org>2025-09-02 13:28:23 -0700
commit355370ac52962a82a292492fdcbda4a52c9f6e7e (patch)
treef5f6055bf37810add8afe678f224b3a9a56cf68d /src/runtime/string.go
parent1eec830f545ae9c75f143d7d5c757013d6d229be (diff)
downloadgo-355370ac52962a82a292492fdcbda4a52c9f6e7e.tar.xz
runtime: add comment for concatstring2
People always want to remove concatstring{2,3,4,5} for performance, but we keep them to make the binary smaller. So, add a comment to document why. Updates #65020 Change-Id: I819976b700d45ce4d0846bf4481b2654b85708da Reviewed-on: https://go-review.googlesource.com/c/go/+/700095 Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Michael Pratt <mpratt@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
Diffstat (limited to 'src/runtime/string.go')
-rw-r--r--src/runtime/string.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/runtime/string.go b/src/runtime/string.go
index 44d586bc53..3726d9235b 100644
--- a/src/runtime/string.go
+++ b/src/runtime/string.go
@@ -59,6 +59,9 @@ func concatstrings(buf *tmpBuf, a []string) string {
return s
}
+// concatstring2 helps make the callsite smaller (compared to concatstrings),
+// and we think this is currently more valuable than omitting one call in the
+// chain, the same goes for concatstring{3,4,5}.
func concatstring2(buf *tmpBuf, a0, a1 string) string {
return concatstrings(buf, []string{a0, a1})
}
@@ -108,6 +111,9 @@ func concatbytes(buf *tmpBuf, a []string) []byte {
return b
}
+// concatbyte2 helps make the callsite smaller (compared to concatbytes),
+// and we think this is currently more valuable than omitting one call in
+// the chain, the same goes for concatbyte{3,4,5}.
func concatbyte2(buf *tmpBuf, a0, a1 string) []byte {
return concatbytes(buf, []string{a0, a1})
}