3 ms·
You can also align data to cache lines if you want to in Rust, without unsafe [1]. It is not C/C++ specific. For linked list, you can use an unsafe implementat
by pca006132 5y ago
You can also align data to cache lines if you want to in Rust, without unsafe [1]. It is not C/C++ specific.
For linked list, you can use an unsafe implementation if that is performance critical. Unsafe implementation can be wrapped in a safe API for others to use, and this is how the standard library is implemented.
There is also a new paper about structures with internal sharing such as graphs without runtime overhead that Rc/RefCell would cause [2].
[1]: https://doc.rust-lang.org/reference/type-layout.html#the-c-representation https://doc.rust-lang.org/reference/type-layout.html#the-c-r...
[2]: http://plv.mpi-sws.org/rustbelt/ghostcell/ http://plv.mpi-sws.org/rustbelt/ghostcell/