Skip to content

cmd/compile: suboptimal code for string equality #59684

@randall77

Description

@randall77

The optimizations of string equality are somewhat fragile. Particularly, the optimization of deciding when we don't need the full generality of memequal and can do something better instead.

The ordering of equality can make a difference, when it really shouldn't. Some orderings generate a memequal call, and some don't.

Compares that are obviously constant-sized, like those against the empty string, can sometimes still generate memequal calls.

Noticed as part of the truthy benchmarks, mentioned here.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions