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: generate better eq algs for some array types #37866

Closed
josharian opened this issue Mar 15, 2020 · 2 comments
Closed

cmd/compile: generate better eq algs for some array types #37866

josharian opened this issue Mar 15, 2020 · 2 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Milestone

Comments

@josharian
Copy link
Contributor

func geneq in alg.go contains this comment:

	case TARRAY:
		// An array of pure memory would be handled by the
		// standard memequal, so the element type must not be
		// pure memory. Even if we unrolled the range loop,
		// each iteration would be a function call, so don't bother
		// unrolling.

This is not quite true. Floats can’t be compared as pure mem, but don’t require a function call.

And some things that do require a function call are nevertheless susceptible to more optimization. For example, for comparing arrays of strings, we could compare all lengths first (possibly unrolled), and only compare bytes if all lengths agree. Probably something similar for interfaces.

We might even want to inline or partially inline some of these cases.

@cagedmantis cagedmantis added this to the Backlog milestone Mar 16, 2020
@cagedmantis
Copy link
Contributor

/cc @randall77 @griesemer

@cagedmantis cagedmantis added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 16, 2020
@josharian
Copy link
Contributor Author

I did a bunch of this for 1.15. Going to call this done enough. The remaining outstanding cases (arrays of structs, arrays of arrays) are rare and already have a separate issue filed.

@golang golang locked and limited conversation to collaborators Apr 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Performance
Projects
None yet
Development

No branches or pull requests

4 participants