You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the SSA backend, we could optimize a call to runtime.memequal in which the length is small and one argument points to a readonly data symbol. We could replace it by reading the readonly data and checking the bytes of the other argument directly.
This is similar to the optimization in walk.go for comparing against a constant string, and could potentially supercede it. The optimization in walk.go doesn't always trigger. An example is using strings.HasPrefix to check for a constant prefix; the call gets inlined, but walk.go isn't able to do the optimization because its analysis isn't powerful enough.
Low priority.
The text was updated successfully, but these errors were encountered:
josharian
added
NeedsFix
The path to resolution is known, but the work has not been done.
and removed
NeedsDecision
Feedback is required from experts, contributors, and/or the community before a change can be made.
labels
Feb 18, 2020
This CL adds late expanded memequal(x, const, sz) inlining for 2, 4, 8
bytes size. This PoC is using the same method as CL 248404.
This optimization fires about 100 times in Go compiler (1675 occurrences
reduced to 1574, so -6%).
Also, added unit-tests to codegen/comparisions.go file.
Updates #37275
Change-Id: Ia52808d573cb706d1da8166c5746ede26f46c5da
Reviewed-on: https://go-review.googlesource.com/c/go/+/328291
Reviewed-by: Cherry Mui <cherryyz@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>
Trust: David Chase <drchase@google.com>
In the SSA backend, we could optimize a call to runtime.memequal in which the length is small and one argument points to a readonly data symbol. We could replace it by reading the readonly data and checking the bytes of the other argument directly.
This is similar to the optimization in walk.go for comparing against a constant string, and could potentially supercede it. The optimization in walk.go doesn't always trigger. An example is using strings.HasPrefix to check for a constant prefix; the call gets inlined, but walk.go isn't able to do the optimization because its analysis isn't powerful enough.
Low priority.
The text was updated successfully, but these errors were encountered: