Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What he is missing is that if the max. 3 pointer comparisons in (together with the function call of `Is`)

    if err == nil || target == nil {
        return err == target
    }
are a "pretty big performance penalty", there isn't much work going on. I mean, of course, these 2 or 3 comparisons + the function call of `Is` are at least double that of

      err != nil
even if `Is` would have been inlined by the compiler.


Actually, the `err == nil` check doesn't exist in the latest release. It was added recently, which would explain the significant performance cost. If err is nil, it doesn't return early.

https://github.com/golang/go/blame/adbfb672ba485630d75f8b559...





Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: