Hacker News new | past | comments | ask | show | jobs | submit login

I would have expected some hash tables instead of long chains of if-statements.



The quirks are called at the appropriate places, and can be inlined using LTO. The same places would need to hash the current context and check if it's in the hash map (is it one global hash map, or a specialized one for each quirk, with an optimised hashing function?). And on a match, you need to do the full check anyway, due to likely collisions.

The conditionals in the full check seem to use symbolised strings where possible, so they're quite fast. Probably faster than producing a suitable hash.


Why? If it’s not dynamic, why make your life harder and slower? Nothing beats a compare and jump compiled into your binary.


Only as long as your compiler optimises it into a jump table, which is effectively a hash table.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: