60% Faster Substring Search in Zig using SIMD

This article details how the author achieved a ~60% speedup in substring search within the Zig programming language using SIMD instructions. A SIMD-friendly algorithm was implemented, extracting the first and last characters of the target substring and leveraging SIMD parallel comparisons to significantly reduce memory accesses. Benchmarks show an 80% reduction in CPU cycles and substantial speed improvements, especially with large texts. While gains are less significant with smaller texts, the potential of SIMD is clearly demonstrated. The article also explores performance variations with different character selections and SIMD instruction sets (AVX2, AVX-512), and discusses why this optimization wasn't integrated into Zig's standard library.