Per Vognsen on the effect of AVX-512 on lexing and parsing

32 points by dvogel


dvogel

I thought this was a really insightful experience report highlighting how the CPU doesn't see abstractions and optimizes across what we perceive as different parts of a program.

andyc

Hm I am missing context - does Zig have a single pass compiler anywhere? (for debug builds or something)

The TL; DR is that if you're writing a very fast compiler like this where lexing is a significant time cost, it's almost certainly not worth it to use even a hyper-optimized SIMD lexer.

That is what I would have expected with any "real" compiler like the Zig compiler. I would expect code gen even in debug builds to take a lot longer than lexing or parsing, so there wouldn't be much speedup from using SIMD in the lexer