Skip to content

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

@josharian

Description

@josharian

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions