Comment

Comment by jcranmer

Compiler optimizations are a trade-off between compile time, runtime, and code size, mediated by the availability of developer time.

Perfect hashing for switch tables is useful mostly for large, sparse switches, but hot large, sparse switches are rare, and the closest examples I can think of (e.g., parse tables) are themselves likely generated from other tools, which could itself be changed in lieu of the compiler. It really doesn't come across as a useful optimization to try implementing in a compiler.

parent jcranmer 10 hours ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton