https://go-review.googlesource.com/c/go/+/576015 this change to optimise errors.Is in the err == nil case was merged recently. It’s not included in the latest Go release, hence the stats here, but should end up in a release pretty soon I’d imagine.
Deleted Comment
Deleted Comment
Deleted Comment
Deleted Comment
if err == nil || target == nil {
return err == target
}
So the overhead is the function call and 2 comparisons. I wonder if the `isComparable := reflectlite.TypeOf(target).Comparable()` line was moved into a separate function if the compiler would inline Is() reducing the perf impact.Possibly related: https://github.com/golang/go/issues/61502
Looks like they're working on improving the inliner.
Deleted Comment