4 ms·
On index benchmark results: >Still not quite as fast as Go, but it's close. Honestly, I don't know why the memchr-based implementation is still slower than Go'
by johaugum 6mo ago
On index benchmark results:
>Still not quite as fast as Go, but it's close. Honestly, I don't know why the memchr-based implementation is still slower than Go's assembly here, but I decided not to pursue it any further.
Libc call overhead. Your version is using an already-fast memchr, but it still has to cross a general libc boundary and then do the pointer/index around it.
Index with a 1-byte needle collapses to IndexByte, and on arm64 that goes into Go asm.