- Sources: primary, discussion
- Summary: GitHub describes case folding source code for search at over 45 GiB/s. Removing the early exit on the first non-ASCII byte was faster than keeping it, because the branch cost more than sweeping the whole buffer. The post also separates case folding from lowercasing, and names characters where the two differ.
- Why it matters: The obvious optimization is the bug: breaking out of the loop at the first non-ASCII byte costs more in branches than sweeping the whole buffer, and the post separates case folding from lowercasing, which quietly produces wrong matches on characters like the sharp s and final sigma.
send feedback on this story