Hacker News new | ask | show | jobs
by johaugum 73 days 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.