SIMD Substring in a String
summary
Vectorized substring search replaces byte-by-byte loops with SIMD loads, first+last char prefilter (a cheap Robin–Karp style hash), and unrolled 32‑byte comparisons to cut work and branches. Benchmarks use libc++/strstr, std::search/mismatch and the eve SIMD library and show ~8–20× speedups over naive scalar code and 2–10× wins vs standard functions on large needles, while behavior on Apple M2 is weaker due to different unrolling and 16‑byte codegen; the SIMD implementation proves markedly faster and practical.
AI-written summary · about
