Suggest strings.Contains instead of strings.ContainsAny for search of 1 char
quasilyte opened this issue · 2 comments
quasilyte commented
This may sound silly, but it's easy to implement.
The underlying issue is that ContainsAny
is not always a fast choice.
See https://github.com/golang/go/issues/31321
TODO: do the actual benchmarking.
tdakkota commented
Why not suggest strings.ContainsRune
?
quasilyte commented
I think initially I was concerned about this case: strings.ContainsAny(s, "ab")
vs 2 calls of ContainsRune or one manually written loop, like in the referenced issue.