2 ms·
> On the other hand, pointer chasing often isn't as bad as you think it might be. It kinda really is, though. In addition to cache line locality, serial access
by kllrnohj 4y ago
> On the other hand, pointer chasing often isn't as bad as you think it might be.
It kinda really is, though. In addition to cache line locality, serial access also benefits from being speculatable. The CPU can't very effectively speculate past a pointer chase (and on arm little cores it doesn't even try), so those become pipeline stalls.
Even if the pointer happened to be close-ish, it's still going to end up being a stall more often than not.
And an allocator / GC is only going to lay out a linked list in any sort of predictable way if the linked list is built up all at once, in which case a linked list is obviously not the right data structure anyway ;)