Skip to content

runtime: memequal missing short circuit for equal pointers on arm64 #64381

@josharian

Description

@josharian

Go version

tip as of Nov 24, 2023

Reproducibility

  • Does this issue reproduce with the latest release?

What operating system and processor architecture are you using (go env)?

not relevant

What did you do?

amd64 memequal starts by comparing pointers and returning true if they are true.

CMPQ AX, BX
JNE neq
MOVQ $1, AX // return 1
RET

arm64 memequal is missing this optimization.

B memeqbody<>(SB)

(Other architectures may also be missing it. I did not check.)

Initially reported as josharian/intern#3

What did you expect to see?

Fast string comparisons of identical strings (same string headers).

What did you see instead?

Comparing their contents on arm64.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions