Beating the Compiler: Writing an Interpreter in Assembly
Matt Keeter wrote a fast interpreter for the Uxn CPU in Rust, but profiling revealed that the dispatch loop consumed over a third of runtime. Inspired by LuaJIT, he rewrote the interpreter in hand-written AArch64 assembly, using indirect threading and keeping all state in registers. The result is a 2400-line assembly implementation that outperforms the compiler-generated code.
Compilers are bad at generating code for interpreters, and it's possible to outperform them by writing your interpreter in assembly.