3 ms·
Depends on your input. If non-ASCII strings are frequent and likely to contain a non-ASCII character fairly close to the start of the string, then it makes sens
by Sharlin 9y ago
Depends on your input. If non-ASCII strings are frequent and likely to contain a non-ASCII character fairly close to the start of the string, then it makes sense to short circuit.
- loeg 9y agoThe previous >0 algorithm didn't short-circuit. There is no change to short-circuit behavior here.
- Sharlin 9y agoAh, I was thinking of the naive implementation in the previous post [1]. [1] https://lemire.me/blog/2018/05/09/how-quickly-can-you-check-that-a-string-is-valid-unicode-utf-8/ https://lemire.me/blog/2018/05/09/how-quickly-can-you-check-...