Skip to content

Commit 355370a

Browse files
fengyoulingopherbot
authored andcommitted
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 golang#65020 Change-Id: I819976b700d45ce4d0846bf4481b2654b85708da Reviewed-on: https://go-review.googlesource.com/c/go/+/700095 Auto-Submit: Keith Randall <[email protected]> Reviewed-by: Michael Pratt <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent 1eec830 commit 355370a

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

src/runtime/string.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ func concatstrings(buf *tmpBuf, a []string) string {
5959
return s
6060
}
6161

62+
// concatstring2 helps make the callsite smaller (compared to concatstrings),
63+
// and we think this is currently more valuable than omitting one call in the
64+
// chain, the same goes for concatstring{3,4,5}.
6265
func concatstring2(buf *tmpBuf, a0, a1 string) string {
6366
return concatstrings(buf, []string{a0, a1})
6467
}
@@ -108,6 +111,9 @@ func concatbytes(buf *tmpBuf, a []string) []byte {
108111
return b
109112
}
110113

114+
// concatbyte2 helps make the callsite smaller (compared to concatbytes),
115+
// and we think this is currently more valuable than omitting one call in
116+
// the chain, the same goes for concatbyte{3,4,5}.
111117
func concatbyte2(buf *tmpBuf, a0, a1 string) []byte {
112118
return concatbytes(buf, []string{a0, a1})
113119
}

0 commit comments

Comments
 (0)