Readit News logoReadit News

Deleted Comment

Deleted Comment

Deleted Comment

Deleted Comment

jamespwilliams commented on Go: Sentinel errors and errors.Is() slow your code down by 3000%   dolthub.com/blog/2024-05-... · Posted by u/ingve
jamespwilliams · 2 years ago
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.
jamespwilliams commented on Go: Sentinel errors and errors.Is() slow your code down by 3000%   dolthub.com/blog/2024-05-... · Posted by u/ingve
esprehn · 2 years ago
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.

jamespwilliams · 2 years ago
That err == nil check was added very recently and isn’t included in the latest Go release, which the author used in this article.
jamespwilliams commented on Google Public DNS's approach to fight against cache poisoning attacks   security.googleblog.com/2... · Posted by u/tatersolid
bradfitz · 2 years ago
Longer domain names are more secure!
jamespwilliams · 2 years ago
And conversely, short domains like Google’s own g.co are less secure!
jamespwilliams commented on Show HN: Goralim - a rate limiting pkg for Go to handle distributed workloads   github.com/0verread/goral... · Posted by u/dasubhajit
jamespwilliams · 2 years ago
Fun weekend project but definitely not production-ready (no tests, no error handling, concurrent requests will cause a race condition, etc.). If readers are looking for something production-ready to use, consider https://github.com/go-redis/redis_rate (which implements GCRA/leaky bucket), or https://github.com/ulule/limiter (which uses a much simpler algorithm, but has good middleware).

Deleted Comment

u/jamespwilliams

KarmaCake day2548August 15, 2020
About
https://github.com/jamespwilliams

Submissions != endorsements

View Original