-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.
Milestone
Description
We manually partially inline utf8.DecodeRune in a few places in the tree. For example, in bytes.EqualFold
, we have:
if s[0] < utf8.RuneSelf {
sr, s = rune(s[0]), s[1:]
} else {
r, size := utf8.DecodeRune(s)
sr, s = r, s[size:]
}
It'd be nice to rewrite utf8.DecodeRune
like this:
func DecodeRune(p []byte) (r rune, size int) {
if len(p) > 0 && p[0] < RuneSelf {
return rune(p[0]), 1
}
return decodeRuneSlow(p)
}
and then let mid-stack inlining take it from there. (And delete all the manual partial inlining.)
Unfortunately, this has a cost of 89, over the budget of 80.
This is basically just another variant of #17566, but I'm filing it separately since that issue is super noisy.
mvdan, tmthrgd, CAFxX, renthraysk, shabbyrobe and 2 more
Metadata
Metadata
Assignees
Labels
NeedsFixThe path to resolution is known, but the work has not been done.The path to resolution is known, but the work has not been done.Performancecompiler/runtimeIssues related to the Go compiler and/or runtime.Issues related to the Go compiler and/or runtime.