perf: fmt.Errorf
used instead of errors.New
#9749
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Throughout the whole codebase there are many places that use
fmt.Errorf
whereaserrors.New
can be used. Usingfmt.Errorf
is roughly 4x slower thanerrors.New
.This can be easily benchmarked with:
On my computer I'm getting:
This performance issue can be automatically fixed with:
Those error paths usually aren't hot paths, however it might impact the size of code generated.
The text was updated successfully, but these errors were encountered: