Everyone should know SIMD(mitchellh.com)
469 points by WadeGrimridge 18 hours ago | 170 comments
tl;dr: SIMD isn't as intimidating as its reputation suggests—most "process N values at a time" optimizations follow a five-step pattern: broadcast constants, loop one vector-width at a time, perform the parallel operation, reduce the result, and handle leftovers with a scalar tail. The author demonstrates with a Zig example from Ghostty that achieves a real-world 5x speedup on a simple codepoint-scanning loop. While compilers can sometimes auto-vectorize, they frequently miss opportunities, so explicit SIMD is worth learning for hot loops over large contiguous data.
HN Discussion:
  • ~Article oversells SIMD's simplicity; it's actually hard despite being worthwhile
  • Personal experience confirms SIMD delivers significant real-world speedups
  • Readers want more practical tutorials and idioms for learning SIMD
  • Understanding compiler auto-vectorization failures matters more than writing SIMD manually
  • ~Data structures and access patterns should be optimized before reaching for SIMD