Tail-Call Interpreters in Rust: A Benchmark of VM Dispatch Techniques
Tail-Call Interpreters in Rust – Jimmy Ostler
Jimmy Ostler explores tail-call interpretation in Rust by implementing several VM dispatch styles inspired by Noel Welsh's Scala post. He covers switch, subroutine, indirect, and direct dispatch, using Rust's unstable `become` keyword for guaranteed tail-call optimization. Benchmarking on a simple stack machine, he finds direct dispatch—where each operation calls the next—performs best on his machine, offering insights for optimizing interpreter performance.
This leads to direct dispatch. We return to objects as bytecode (for now) and let each operation dispatch the next. This results in what turns out to be the best performing variation on my machine.