A decent part of VMs being faster than AST interpreters is just memory layout AIUI.
VM instructions are largely flat arrays, so there's less pointer chasing.
miniblog.
Related Posts
Today I learnt that Cell<T> has the size of a pointer (i.e. probably 64 bits) in Rust, regardless of the size of T.
It's a common pattern for making struct fields mutable, but the T isn't actually stored inside the struct.
Is there any way of doing tagged references in safe Rust?
I've been looking at tagged pointers (the crate https://docs.rs/tagged-pointer/latest/tagged_pointer/ looks excellent) but it gives you back a raw pointer.
I'm not sure if you can create a safe wrapper for references using tagged pointers.
"What do you call a pointer we stole the high bits off? An ointer." https://docs.rs/ointers/latest/ointers/
Brilliant name for a pointer tagging library.