Skip to content

strings: optimize Fields #17856

Description

@dsnet

According to a profiling data from a large number of servers at Google, strings.Fields is within the top 50 functions by CPU time. The current implementation simply calls strings.FieldsFunc(s, unicode.IsSpace). We should consider writing a specialized version without calling unicode.IsSpace. Also, we should should optimize for the fact that ASCII whitespace is by far the most common delimiter.

The same optimization can be applied to the bytes package as well to keep them in sync.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions