When Compiler Optimizations Backfire: How Jump Tables Slowed UTF-8 Parsing by 4x
A benchmark reveals how Clang's jump table optimization for UTF-8 sequence length calculations caused a 4x performance drop compared to branch-based approaches. The surprising findings challenge assumptions about lookup tables and highlight the critical interplay between CPU branch prediction and memory access patterns in performance-critical code.