2 ms·
> 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 For
by RetroTechie 4mo 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).