1
0
mirror of https://github.com/rclone/rclone.git synced 2025-11-29 05:47:23 +02:00

refactor: use strings.Builder to improve performance

This commit is contained in:
dulanting
2025-10-30 00:48:34 +08:00
committed by GitHub
parent a0bcdc2638
commit 87b71dd6b9
3 changed files with 13 additions and 13 deletions

View File

@@ -150,13 +150,13 @@ func TestAsyncReaderSizes(t *testing.T) {
var texts [31]string
str := ""
all := ""
var all strings.Builder
for i := range len(texts) - 1 {
texts[i] = str + "\n"
all += texts[i]
all.WriteString(texts[i])
str += string(rune(i)%26 + 'a')
}
texts[len(texts)-1] = all
texts[len(texts)-1] = all.String()
for h := range len(texts) {
text := texts[h]
@@ -191,13 +191,13 @@ func TestAsyncReaderWriteTo(t *testing.T) {
var texts [31]string
str := ""
all := ""
var all strings.Builder
for i := range len(texts) - 1 {
texts[i] = str + "\n"
all += texts[i]
all.WriteString(texts[i])
str += string(rune(i)%26 + 'a')
}
texts[len(texts)-1] = all
texts[len(texts)-1] = all.String()
for h := range len(texts) {
text := texts[h]