2 ms·
Arrays shine when you access the elements in a predictable order. That's what compiler backend and hardware optimizes for. Blindly replacing pointers with ran
by fooker 3y ago
Arrays shine when you access the elements in a predictable order.
That's what compiler backend and hardware optimizes for.
Blindly replacing pointers with random indexes into large arrays doesn't pan out.
- viraptor 3y agoThis is still really vague. Doesn't pan out how exactly? Arrays aren't a thing at hardware level and are only sometimes a thing in compiler backend. Prefetching the next line helps, but it's irrelevant how the type is represented in the code. (And you can explicitly prefetch from a random address as well) What downsides are you talking about here specifically? Where do the orders of magnitude come from?