Hacker News new | ask | show | jobs
by RetroTechie 1 day ago
> A smarter compiler could detect when a "switch" forms the body of a loop and it would replicate the indexed jump instruction at the end of each case

Some Forths do this to save 1 jump per executed opcode (dispatch -> opcodeA -> opcodeB -> opcodeC etc). At the cost of having X copies of the dispatch code in memory (and perhaps in I-cache too).