Skip to content
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

cmd/compile: optimize small runtime.memequal calls #37275

Open
josharian opened this issue Feb 18, 2020 · 1 comment
Open

cmd/compile: optimize small runtime.memequal calls #37275

josharian opened this issue Feb 18, 2020 · 1 comment

Comments

@josharian
Copy link
Contributor

@josharian josharian commented Feb 18, 2020

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.

@josharian josharian added this to the Backlog milestone Feb 18, 2020
@josharian josharian modified the milestones: Backlog, Unplanned Feb 18, 2020
@toothrot

This comment has been minimized.

Copy link
Contributor

@toothrot toothrot commented Feb 18, 2020

@josharian josharian added NeedsFix and removed NeedsDecision labels Feb 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.