3 ms·
This is really interesting! I wrote a mini Lisp interpreter in Rust while following along with the book! I ended up using a generational arena to store objects
by chlorion 4y ago
This is really interesting!
I wrote a mini Lisp interpreter in Rust while following along with the book! I ended up using a generational arena to store objects too, but I used a "slotmap", which I wrote myself but is similar to the slotmap crate (see link below).
I am surprised and also sad that the arena had such a large performance impact, because it's a very nice pattern and lets you completely avoid unsafe code and raw pointer wrangling.
I do wonder whether changes could have been made to speed up the safe arena style object store! Ideally accessing objects would be as fast as a regular index into a vector which should be pretty fast.
Boxing the inner object in the GcHeader is going to make accessing objects from the Gc do some extra pointer chasing, I think you could avoid this and the dynamic dispatch in general using enums and static generics!
Anyways this was fun to read, thanks!
https://crates.io/crates/slotmap https://crates.io/crates/slotmap