-
Notifications
You must be signed in to change notification settings - Fork 18.7k
reflect: optimize DeepEqual for slice types #64798
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
base: master
Are you sure you want to change the base?
reflect: optimize DeepEqual for slice types #64798
Conversation
|
This PR (HEAD: a58782e) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/551175. Important tips:
|
|
Message from Gopher Robot: Patch Set 1: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
This PR (HEAD: a4ad968) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/551175. Important tips:
|
|
Message from qiulaidongfeng: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Keith Randall: Patch Set 4: (3 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
This PR (HEAD: c6199a8) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/551175. Important tips:
|
|
Message from qiulaidongfeng: Patch Set 5: Run-TryBot+1 (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
This PR (HEAD: 1388942) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/551175. Important tips:
|
|
Message from Gopher Robot: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 5: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 5: TryBot-Result-1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 6: Run-TryBot+1 Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 6: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 6: TryBot-Result+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 6: -Run-TryBot (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 6: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Keith Randall: Patch Set 6: (10 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
This PR (HEAD: 4f7812e) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/551175. Important tips:
|
|
Message from qiulaidongfeng: Patch Set 7: Run-TryBot+1 (8 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 7: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 7: TryBot-Result+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 7: -Run-TryBot Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Keith Randall: Patch Set 7: (6 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
4f7812e to
94c2172
Compare
|
This PR (HEAD: 94c2172) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/551175. Important tips:
|
|
Message from qiulaidongfeng: Patch Set 8: Run-TryBot+1 (6 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 8: TryBot-Result+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 8: -Run-TryBot Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Keith Randall: Patch Set 8: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Cherry Mui: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 8: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Cherry Mui: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 8: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
94c2172 to
5bc9e46
Compare
Change-Id: Iba1b710707114ba0b4358b8f01f083e2dca8f68d
|
This PR (HEAD: ff903bb) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/551175. Important tips:
|
|
Message from qiulaidongfeng: Patch Set 9: Run-TryBot+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Gopher Robot: Patch Set 9: TryBot-Result+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 9: -Run-TryBot Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from Cherry Mui: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
|
Message from qiulaidongfeng: Patch Set 9: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/551175. |
DeepEqual optimize for some types
by comparing two instances of the same type by comparing the raw memory contents
goos: windows
goarch: amd64
pkg: reflect
cpu: AMD Ryzen 7 7840HS w/ Radeon 780M Graphics
│ old.txt │ new.txt │
│ sec/op │ sec/op vs base │
DeepEqual/[]int8-16 55.33n ± 2% 46.89n ± 1% -15.26% (p=0.000 n=10)
DeepEqual/[]int16-16 55.55n ± 3% 46.86n ± 2% -15.65% (p=0.000 n=10)
DeepEqual/[]int32-16 56.11n ± 1% 46.66n ± 1% -16.83% (p=0.000 n=10)
DeepEqual/[]int64-16 55.91n ± 2% 46.62n ± 1% -16.62% (p=0.000 n=10)
DeepEqual/[]int-16 55.58n ± 1% 46.86n ± 1% -15.70% (p=0.000 n=10)
DeepEqual/[]uint8-16 49.30n ± 3% 46.71n ± 1% -5.26% (p=0.000 n=10)
DeepEqual/[]uint16-16 55.90n ± 1% 46.81n ± 1% -16.26% (p=0.000 n=10)
DeepEqual/[]uint32-16 55.33n ± 4% 46.93n ± 1% -15.20% (p=0.000 n=10)
DeepEqual/[]uint64-16 55.77n ± 1% 46.92n ± 1% -15.87% (p=0.000 n=10)
DeepEqual/[]uint-16 55.52n ± 3% 46.86n ± 5% -15.60% (p=0.000 n=10)
DeepEqual/[]uintptr-16 55.68n ± 2% 46.73n ± 2% -16.08% (p=0.000 n=10)
DeepEqual/[]float32-16 55.30n ± 2% 53.16n ± 2% -3.88% (p=0.000 n=10)
DeepEqual/[]float64-16 55.82n ± 1% 53.23n ± 2% -4.65% (p=0.000 n=10)
DeepEqual/[]complex64-16 55.51n ± 2% 53.73n ± 1% -3.21% (p=0.000 n=10)
DeepEqual/[]complex128-16 55.62n ± 3% 53.50n ± 2% -3.81% (p=0.000 n=10)
DeepEqual/[]bool-16 55.56n ± 3% 47.16n ± 1% -15.13% (p=0.000 n=10)
DeepEqual/[]string-16 56.12n ± 3% 53.38n ± 2% -4.88% (p=0.000 n=10)
DeepEqual/[]uint8#01-16 49.73n ± 3% 46.76n ± 2% -5.97% (p=0.000 n=10)
DeepEqual/[][]uint8-16 92.81n ± 1% 89.34n ± 2% -3.73% (p=0.000 n=10)
DeepEqual/[6]uint8-16 76.88n ± 1% 74.58n ± 1% -3.00% (p=0.000 n=10)
DeepEqual/[][6]uint8-16 117.25n ± 1% 47.09n ± 2% -59.83% (p=0.000 n=10)
DeepEqual/[]int16#01-16 91562.5n ± 2% 322.4n ± 2% -99.65% (p=0.000 n=10)
geomean 82.85n 55.41n -33.12%