-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
http/httpguts: speed up ValidHeaderFieldName #207
http/httpguts: speed up ValidHeaderFieldName #207
Conversation
This PR (HEAD: 1f1d25d) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/net/+/578075. Important tips:
|
Message from Gopher Robot: Patch Set 1: Congratulations on opening your first change. Thank you for your contribution! Next steps: Most changes in the Go project go through a few rounds of revision. This can be During May-July and Nov-Jan the Go project is in a code freeze, during which Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Damien Neil: Patch Set 2: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Emmanuel Odeke: Patch Set 2: Commit-Queue+1 Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2024-04-11T05:28:29Z","revision":"272f45c6fe709989158b1e84ff154dbe2041725d"} Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Gopher Robot: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Gopher Robot: Patch Set 2: TryBot-Result+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Emmanuel Odeke: Patch Set 2: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
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/578075. |
Message from Go LUCI: Patch Set 2: LUCI-TryBot-Result+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from jub0bs: Patch Set 2: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Damien Neil: Patch Set 2: Code-Review+2 (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from Dmitri Shuralyov: Patch Set 2: Code-Review+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Message from jub0bs: Patch Set 2: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/578075. |
Eliminate bounds checks and eschews UTF-8 decoding in ValidHeaderFieldName, thereby doubling its speed without introducing any allocations. Also eliminate bounds checks in IsTokenRune. Add tests and benchmarks for both ValidHeaderFieldName and IsTokenRune. goos: darwin goarch: amd64 pkg: golang.org/x/net/http/httpguts cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz │ before │ after │ │ sec/op │ sec/op vs base │ IsTokenRune-8 315.2n ± 0% 316.2n ± 1% ~ (p=0.245 n=20) ValidHeaderFieldName-8 62.77n ± 0% 29.16n ± 0% -53.55% (p=0.000 n=20) geomean 140.7n 96.02n -31.73% │ before │ after │ │ B/op │ B/op vs base │ IsTokenRune-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20) ValidHeaderFieldName-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20) geomean ² +0.00% │ before │ after │ │ allocs/op │ allocs/op vs base │ IsTokenRune-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20) ValidHeaderFieldName-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20) geomean ² +0.00% Fixes golang/go#66700 Change-Id: Ia3ea80e5f0d173e3a69eb7429023587fd7bc5933 GitHub-Last-Rev: 1f1d25d GitHub-Pull-Request: #207 Reviewed-on: https://go-review.googlesource.com/c/net/+/578075 Run-TryBot: Emmanuel Odeke <emmanuel@orijtech.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This PR is being closed because golang.org/cl/578075 has been merged. |
Eliminate bounds checks and eschews UTF-8 decoding in ValidHeaderFieldName,
thereby doubling its speed without introducing any allocations.
Also eliminate bounds checks in IsTokenRune.
Add tests and benchmarks for both ValidHeaderFieldName and IsTokenRune.
goos: darwin
goarch: amd64
pkg: golang.org/x/net/http/httpguts
cpu: Intel(R) Core(TM) i7-6700HQ CPU @ 2.60GHz
│ before │ after │
│ sec/op │ sec/op vs base │
IsTokenRune-8 315.2n ± 0% 316.2n ± 1% ~ (p=0.245 n=20)
ValidHeaderFieldName-8 62.77n ± 0% 29.16n ± 0% -53.55% (p=0.000 n=20)
geomean 140.7n 96.02n -31.73%
IsTokenRune-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20)
ValidHeaderFieldName-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20)
geomean ² +0.00%
IsTokenRune-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20)
ValidHeaderFieldName-8 0.000 ± 0% 0.000 ± 0% ~ (p=1.000 n=20)
geomean ² +0.00%
Fixes golang/go#66700