-
Notifications
You must be signed in to change notification settings - Fork 18.4k
all: replace strings.Split with strings.SplitSeq #75259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This PR (HEAD: c93496b) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/701015. Important tips:
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from qiu laidongfeng: Patch Set 1: Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 1: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-09-04T16:53:30Z","revision":"36dbe0cc13b6a7c04877462eb74fd3bb4756b18a"} Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from qiu laidongfeng: Patch Set 1: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 1: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 1: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Keith Randall: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Emmanuel Odeke: Patch Set 1: Commit-Queue+1 Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 1: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-09-05T07:23:38Z","revision":"36dbe0cc13b6a7c04877462eb74fd3bb4756b18a"} Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Emmanuel Odeke: Patch Set 1: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 1: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
This PR (HEAD: f56319c) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/701015. Important tips:
|
Message from 黄志文: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Emmanuel Odeke: Patch Set 2: Commit-Queue+1 Run-TryBot+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-09-05T13:21:28Z","revision":"1a1afff20ad94e562697e6d83b03334345f93a42"} Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Gopher Robot: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Emmanuel Odeke: Patch Set 2: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 2: This CL has failed the run. Reason: Tryjob golang/try/gotip-windows-amd64-longtest has failed with summary (view all results):
To reproduce, try Additional links for debugging: Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 2: LUCI-TryBot-Result-1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Sean Liao: Patch Set 4: Commit-Queue+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 4: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-09-06T09:18:35Z","revision":"1089ed7c6dc8eba046706937e3a771e0ce8ced21"} Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Sean Liao: Patch Set 4: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 4: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 4: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Sean Liao: Patch Set 5: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Keith Randall: Patch Set 5: Code-Review+2 (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
This PR (HEAD: 392b315) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/701015. Important tips:
|
Message from 黄志文: Patch Set 6: (4 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 6: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Keith Randall: Patch Set 6: Auto-Submit+1 Code-Review+2 Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 6: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-09-15T14:24:23Z","revision":"ab75c41d69960d5f48dcfe984c246959d686902a"} Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Keith Randall: Patch Set 6: Code-Review+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 6: LUCI-TryBot-Result-1 Copied votes on follow-up patch sets have been updated:
Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 7: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-09-15T14:40:00Z","revision":"e60efc0d082437b9cb576dc58062981b1021c6f4"} Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Emmanuel Odeke: Patch Set 7: Auto-Submit+1 Code-Review+2 Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from 黄志文: Patch Set 7: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Emmanuel Odeke: Patch Set 7: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Keith Randall: Patch Set 7: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 7: This CL has passed the run Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
Message from Go LUCI: Patch Set 7: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
In Go 1.25+, strings.SplitSeq offers better performance. Here are the benchmark results comparing strings.Split and strings.SplitSeq in a for-loop, with the benchmark code located in src/strings/iter_test.go: goos: darwin goarch: amd64 pkg: cmd/go/internal/auth cpu: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz │ old.txt │ new.txt │ │ sec/op │ sec/op vs base │ ParseGitAuth/standard-8 281.4n ± 1% 218.0n ± 11% -22.54% (p=0.000 n=10) ParseGitAuth/with_url-8 549.1n ± 1% 480.5n ± 13% -12.48% (p=0.002 n=10) ParseGitAuth/minimal-8 235.4n ± 1% 197.3n ± 7% -16.20% (p=0.000 n=10) ParseGitAuth/complex-8 797.6n ± 2% 805.2n ± 4% ~ (p=0.481 n=10) ParseGitAuth/empty-8 87.48n ± 3% 63.25n ± 6% -27.71% (p=0.000 n=10) ParseGitAuth/malformed-8 228.8n ± 1% 171.2n ± 3% -25.17% (p=0.000 n=10) geomean 288.9n 237.7n -17.72% │ old.txt │ new.txt │ │ B/op │ B/op vs base │ ParseGitAuth/standard-8 192.00 ± 0% 96.00 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/with_url-8 400.0 ± 0% 288.0 ± 0% -28.00% (p=0.000 n=10) ParseGitAuth/minimal-8 144.00 ± 0% 80.00 ± 0% -44.44% (p=0.000 n=10) ParseGitAuth/complex-8 528.0 ± 0% 400.0 ± 0% -24.24% (p=0.000 n=10) ParseGitAuth/empty-8 32.00 ± 0% 16.00 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/malformed-8 176.00 ± 0% 80.00 ± 0% -54.55% (p=0.000 n=10) geomean 179.0 102.1 -42.96% │ old.txt │ new.txt │ │ allocs/op │ allocs/op vs base │ ParseGitAuth/standard-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) ParseGitAuth/with_url-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10) ParseGitAuth/minimal-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) ParseGitAuth/complex-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10) ParseGitAuth/empty-8 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10) ParseGitAuth/malformed-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10) geomean 3.086 2.040 -33.91% Updates #69315. Change-Id: Id0219edea45d9658d527b863162ebe917e7821d9 GitHub-Last-Rev: 392b315 GitHub-Pull-Request: #75259 Reviewed-on: https://go-review.googlesource.com/c/go/+/701015 Reviewed-by: Keith Randall <khr@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Reviewed-by: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Emmanuel Odeke <emmanuel@orijtech.com>
Message from Michael Knyszek: Patch Set 7: Code-Review+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/701015. |
This PR is being closed because golang.org/cl/701015 has been merged. |
In Go 1.25+, strings.SplitSeq offers better
performance. Here are the benchmark results comparing
strings.Split and strings.SplitSeq in a for-loop, with the
benchmark code located in src/strings/iter_test.go:
goos: darwin
goarch: amd64
pkg: cmd/go/internal/auth
cpu: Intel(R) Core(TM) i7-8569U CPU @ 2.80GHz
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
ParseGitAuth/standard-8 281.4n ± 1% 218.0n ± 11% -22.54% (p=0.000 n=10)
ParseGitAuth/with_url-8 549.1n ± 1% 480.5n ± 13% -12.48% (p=0.002 n=10)
ParseGitAuth/minimal-8 235.4n ± 1% 197.3n ± 7% -16.20% (p=0.000 n=10)
ParseGitAuth/complex-8 797.6n ± 2% 805.2n ± 4% ~ (p=0.481 n=10)
ParseGitAuth/empty-8 87.48n ± 3% 63.25n ± 6% -27.71% (p=0.000 n=10)
ParseGitAuth/malformed-8 228.8n ± 1% 171.2n ± 3% -25.17% (p=0.000 n=10)
geomean 288.9n 237.7n -17.72%
ParseGitAuth/standard-8 192.00 ± 0% 96.00 ± 0% -50.00% (p=0.000 n=10)
ParseGitAuth/with_url-8 400.0 ± 0% 288.0 ± 0% -28.00% (p=0.000 n=10)
ParseGitAuth/minimal-8 144.00 ± 0% 80.00 ± 0% -44.44% (p=0.000 n=10)
ParseGitAuth/complex-8 528.0 ± 0% 400.0 ± 0% -24.24% (p=0.000 n=10)
ParseGitAuth/empty-8 32.00 ± 0% 16.00 ± 0% -50.00% (p=0.000 n=10)
ParseGitAuth/malformed-8 176.00 ± 0% 80.00 ± 0% -54.55% (p=0.000 n=10)
geomean 179.0 102.1 -42.96%
ParseGitAuth/standard-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
ParseGitAuth/with_url-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10)
ParseGitAuth/minimal-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
ParseGitAuth/complex-8 4.000 ± 0% 3.000 ± 0% -25.00% (p=0.000 n=10)
ParseGitAuth/empty-8 2.000 ± 0% 1.000 ± 0% -50.00% (p=0.000 n=10)
ParseGitAuth/malformed-8 3.000 ± 0% 2.000 ± 0% -33.33% (p=0.000 n=10)
geomean 3.086 2.040 -33.91%
Updates #69315.