-
Notifications
You must be signed in to change notification settings - Fork 18.4k
encoding/asn1: use reflect.TypeAssert to improve performance #75825
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: dc8a5d1) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/710555. Important tips:
|
Message from Carlana Johnson: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from kyose chang: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from kyose chang: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Carlana Johnson: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Use "reflect.TypeAssert" can gain some performance improvements: goos: darwin goarch: arm64 pkg: encoding/asn1 cpu: Apple M4 │ old │ new │ │ sec/op │ sec/op vs base │ ObjectIdentifierString-10 51.48n ± 1% 49.72n ± 2% -3.41% (p=0.000 n=10) Marshal-10 7.549µ ± 0% 7.466µ ± 1% -1.10% (p=0.000 n=10) Unmarshal-10 1.808µ ± 0% 1.798µ ± 0% -0.58% (p=0.000 n=10) geomean 889.0n 873.8n -1.70% │ old │ new │ │ B/op │ B/op vs base │ ObjectIdentifierString-10 32.00 ± 0% 32.00 ± 0% ~ (p=1.000 n=10) ¹ Marshal-10 7.336Ki ± 0% 7.336Ki ± 0% ~ (p=1.000 n=10) ¹ Unmarshal-10 432.0 ± 0% 432.0 ± 0% ~ (p=1.000 n=10) ¹ geomean 470.0 470.0 +0.00% ¹ all samples are equal │ old │ new │ │ allocs/op │ allocs/op vs base │ ObjectIdentifierString-10 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹ Marshal-10 271.0 ± 0% 271.0 ± 0% ~ (p=1.000 n=10) ¹ Unmarshal-10 24.00 ± 0% 24.00 ± 0% ~ (p=1.000 n=10) ¹ geomean 18.67 18.67 +0.00% ¹ all samples are equal Updates golang#62121
dc8a5d1
to
c87aae5
Compare
This PR (HEAD: c87aae5) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/710555. Important tips:
|
Message from kyose chang: Patch Set 2: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Keith Randall: Patch Set 2: Auto-Submit+1 Code-Review+2 Commit-Queue+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-10-20T16:28:36Z","revision":"e99d704b932d654ae70985901ea5d78d596cd2a0"} Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Keith Randall: Patch Set 2: Code-Review+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Keith Randall: Patch Set 2: -Commit-Queue Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Go LUCI: Patch Set 2: This CL has failed the run. Reason: Tryjob golang/try/gotip-linux-amd64-race 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/710555. |
Message from Go LUCI: Patch Set 2: LUCI-TryBot-Result-1 Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Roland Shoemaker: Patch Set 2: Code-Review+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Keith Randall: Patch Set 2: Commit-Queue+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Message from Go LUCI: Patch Set 2: Dry run: CV is trying the patch. Bot data: {"action":"start","triggered_at":"2025-10-20T17:06:50Z","revision":"e99d704b932d654ae70985901ea5d78d596cd2a0"} Please don’t reply on this GitHub thread. Visit golang.org/cl/710555. |
Use "reflect.TypeAssert" can gain some performance improvements: goos: darwin goarch: arm64 pkg: encoding/asn1 cpu: Apple M4 │ old │ new │ │ sec/op │ sec/op vs base │ ObjectIdentifierString-10 51.48n ± 1% 49.72n ± 2% -3.41% (p=0.000 n=10) Marshal-10 7.549µ ± 0% 7.466µ ± 1% -1.10% (p=0.000 n=10) Unmarshal-10 1.808µ ± 0% 1.798µ ± 0% -0.58% (p=0.000 n=10) geomean 889.0n 873.8n -1.70% │ old │ new │ │ B/op │ B/op vs base │ ObjectIdentifierString-10 32.00 ± 0% 32.00 ± 0% ~ (p=1.000 n=10) ¹ Marshal-10 7.336Ki ± 0% 7.336Ki ± 0% ~ (p=1.000 n=10) ¹ Unmarshal-10 432.0 ± 0% 432.0 ± 0% ~ (p=1.000 n=10) ¹ geomean 470.0 470.0 +0.00% ¹ all samples are equal │ old │ new │ │ allocs/op │ allocs/op vs base │ ObjectIdentifierString-10 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹ Marshal-10 271.0 ± 0% 271.0 ± 0% ~ (p=1.000 n=10) ¹ Unmarshal-10 24.00 ± 0% 24.00 ± 0% ~ (p=1.000 n=10) ¹ geomean 18.67 18.67 +0.00% ¹ all samples are equal Updates #62121 Change-Id: I139b9d0c729c36018d4e00216ab6fc8388f3b51b GitHub-Last-Rev: c87aae5 GitHub-Pull-Request: #75825 Reviewed-on: https://go-review.googlesource.com/c/go/+/710555 Reviewed-by: Roland Shoemaker <[email protected]> Reviewed-by: Keith Randall <[email protected]> Reviewed-by: Keith Randall <[email protected]> Auto-Submit: Keith Randall <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
This PR is being closed because golang.org/cl/710555 has been merged. |
Use "reflect.TypeAssert" can gain some performance improvements:
goos: darwin
goarch: arm64
pkg: encoding/asn1
cpu: Apple M4
│ old │ new │
│ sec/op │ sec/op vs base │
ObjectIdentifierString-10 51.48n ± 1% 49.72n ± 2% -3.41% (p=0.000 n=10)
Marshal-10 7.549µ ± 0% 7.466µ ± 1% -1.10% (p=0.000 n=10)
Unmarshal-10 1.808µ ± 0% 1.798µ ± 0% -0.58% (p=0.000 n=10)
geomean 889.0n 873.8n -1.70%
ObjectIdentifierString-10 32.00 ± 0% 32.00 ± 0% ~ (p=1.000 n=10) ¹
Marshal-10 7.336Ki ± 0% 7.336Ki ± 0% ~ (p=1.000 n=10) ¹
Unmarshal-10 432.0 ± 0% 432.0 ± 0% ~ (p=1.000 n=10) ¹
geomean 470.0 470.0 +0.00%
¹ all samples are equal
ObjectIdentifierString-10 1.000 ± 0% 1.000 ± 0% ~ (p=1.000 n=10) ¹
Marshal-10 271.0 ± 0% 271.0 ± 0% ~ (p=1.000 n=10) ¹
Unmarshal-10 24.00 ± 0% 24.00 ± 0% ~ (p=1.000 n=10) ¹
geomean 18.67 18.67 +0.00%
¹ all samples are equal
Updates #62121