| 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:
| |