2 ms·
> So you are talking about 1500 cycles to....avoid a single cache line miss due to chasing a linked list pointer? No I'm talking about 1500 cycles to avoid 100
by kllrnohj 5y ago
> So you are talking about 1500 cycles to....avoid a single cache line miss due to chasing a linked list pointer?
No I'm talking about 1500 cycles to avoid 1000 cache line misses. Ordering only matters if you're traversing, and traversing a linked list sure as shit isn't a single cache line miss as I'm sure you know.
> And a (moving) garbage collector is going to dynamically reorganize the nodes of a list, generally in a breadth-first way, depending on the marking algorithm.
We're talking about Rust & C++. There isn't a moving GC.
> You don't get to pick the application behavior. If it needs to a do a lot of inserts and traversals, it just does.
If it's doing that linked lists perform terribly. Traversals of linked lists that suddenly become a million long are insanely slow. That's dependent loads and cache misses all the way through. And even if your hypothetical GC works flawlessly giving you maximum compactness, you're still blowing likely half your throughput & cache size on pointers to neighboring nodes. Even more if it's a doubly-linked list.
> Sometimes lists are just the best damn thing.
It's potentially possible, sure, as I even acknowledged but you seem to have skipped. No, the argument is that they are rarely the right thing, so the focus on them being difficult in Rust is irrelevant.
If you actually know doubly linked lists are what you need then Rusty's unsafe is almost certainly not a deterrent.