Skip to content

cmpstring is too slow to use for equality and inequality #1161

@robpike

Description

@robpike
The code for

var a, b string
if a == b ...

calls runtime.cmpstring. If a and b are different lengths, equality could be tested
without even calling the function, or at least by calling a specialized equality tester.
 The cmpstring function scans the strings, which is usually unnecessary.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions