3 ms·
I see doubly-linked lists and other self-referential structures all the time in low-level code. Boost even has a whole library dedicated to them: http://www.boo
by cycloptic 6y ago
I see doubly-linked lists and other self-referential structures all the time in low-level code. Boost even has a whole library dedicated to them: http://www.boost.org/libs/intrusive http://www.boost.org/libs/intrusive
- steveklabnik 6y agoFor a really interesting take on this area, see http://dtrace.org/blogs/bmc/2018/09/28/the-relative-performance-of-c-and-rust/ http://dtrace.org/blogs/bmc/2018/09/28/the-relative-performa... Specifically, the discussion about intrusive vs non-intrusive data structures and their frequency.
- cycloptic 6y agoIt would be interesting to see how that measures up in a different test where the accesses are all from a cold cache.
- nchi3 6y agoYeah, hence high level non-GCed language. Using heap allocated linked lists is rarely the way to go if you're not developing for embedded. However, if you're developing for embedded you'll probably want to be familiar with unsafe either way if you're going to use Rust. Regarding self-referencing: Rust encourages you to design differently, which I've found leads to nicer and more thought out designs most of the time. Not all algorithms are possible (or efficient) without it though, and for those you'll have to use unsafe if you _really_ have to implement them yourself.