Comment

Comment by esprehn

The happy path is still just nil comparison though:

  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.

parent esprehn 2 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton