Ushering out strlcpy()
Ushering out strlcpy()
Posted Aug 26, 2022 22:37 UTC (Fri) by tialaramex (subscriber, #21167)In reply to: Ushering out strlcpy() by wtarreau
Parent article: Ushering out strlcpy()
https://docs.rs/memchr/latest/memchr/ is the uh, extremely complicated result of somebody who really cares about the sort of optimizations you're discussing attacking this problem. It is of course named after C's memchr() function which is exactly like strchr() except not specialized for C-style 0-terminated strings.
Specifically this is by BurntSushi, who also wrote ripgrep the very fast grep implementation. So yes, you certainly can (at least amortized over huge input slices) go significantly faster than the naive loop I wrote if you are willing to work a lot harder than I did, or to use somebody else's work.
