Skip to content

strings: Index(s, "x") not as optimized as bytes.IndexByte #3751

@bradfitz

Description

@bradfitz
bytes.IndexByte is implemented in assembly:

http://golang.org/pkg/bytes/#IndexByte

The strings package lacks an IndexByte method.  It does have a special case for Index
when len(sep) == 1, but not in assembly:

http://golang.org/src/pkg/strings/strings.go?s=1834:1863#L71

Low priority, but inconsistent. I noticed a couple weeks ago when I was looking at some
profiles.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions