internal/stringslite: use bytealg.MakeNoZero in Clone#77874
internal/stringslite: use bytealg.MakeNoZero in Clone#77874jub0bs wants to merge 1 commit intogolang:masterfrom
Conversation
|
This PR (HEAD: aa95dbc) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/750220. Important tips:
|
CL 456336 introduced bytealg.MakeNoZero and leveraged it, for better
performance, in many places of the strings package, but omitted to do so
in Clone. This CL remedies that omission and also opportunistically
modernizes BenchmarkClone by adopting B.Loop.
Here are some benchmark results:
goos: darwin
goarch: arm64
pkg: strings
cpu: Apple M4
│ old │ new │
│ sec/op │ sec/op vs base │
Clone-10 19.79n ± 0% 17.45n ± 0% -11.82% (p=0.000 n=20)
│ old │ new │
│ B/op │ B/op vs base │
Clone-10 48.00 ± 0% 48.00 ± 0% ~ (p=1.000 n=20) ¹
¹ all samples are equal
│ old │ new │
│ allocs/op │ allocs/op vs base │
Clone-10 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=20) ¹
¹ all samples are equal
aa95dbc to
0ecc7e6
Compare
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
This PR (HEAD: 0ecc7e6) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/750220. Important tips:
|
|
Message from jub0bs: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from jub0bs: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Jorropo: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Jorropo: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Jorropo: Patch Set 2: Auto-Submit+1 Code-Review+2 Commit-Queue+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2026-03-01T06:56:27Z","revision":"8827611465ec707fd4fa9456c254c8f6fe8a08c3"} Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Jorropo: Patch Set 2: -Commit-Queue (Performed by <GERRIT_ACCOUNT_60063> on behalf of <GERRIT_ACCOUNT_55763>) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Go LUCI: Patch Set 2: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Go LUCI: Patch Set 2: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from jub0bs: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Jorropo: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from jub0bs: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Jorropo: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from Jorropo: Patch Set 2: -Code-Review Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from t hepudds: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
|
Message from t hepudds: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/750220. |
CL 456336 introduced bytealg.MakeNoZero and leveraged it, for better
performance, in many places of the strings package, but omitted to do so
in Clone.
This CL remedies that omission and also opportunistically
modernizes BenchmarkClone by adopting B.Loop.
Here are some benchmark results:
goos: darwin
goarch: arm64
pkg: strings
cpu: Apple M4
│ old │ new │
│ sec/op │ sec/op vs base │
Clone-10 19.79n ± 0% 17.45n ± 0% -11.82% (p=0.000 n=20)
Clone-10 48.00 ± 0% 48.00 ± 0% ~ (p=1.000 n=20) ¹
¹ all samples are equal
Clone-10 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=20) ¹
¹ all samples are equal