↓ Skip to main content

“There was just one hotspot that dwarfed all the others, and that was the instruction decode and execution switch-block.”

artemis.sh ↗

V8 only optimizes a switch with fewer than 128 cases. A z80 has more opcodes than that. Swapping the switch for an array of functions made the emulator 10x faster. The JIT was doing nothing, and nobody checked.