News for hackers. Stuff that matters.
Re:Why do arrays start at 0? by kaba0 on Thursday August 25, 2022 @03:42AM (#32590792)
But it will still execute with likely no extra time at all due to OOE and how fast arithmetics are.
Re:Why do arrays start at 0? by murderfs on Thursday August 25, 2022 @01:56PM (#32597436)
OOE doesn't necessarily save you if you end up with a hard dependency on the value of the read (and even if it did, the little cores on ARM SoCs are in-order). This is a pretty obvious candidate for macro-op fusion, but I'm not sure whether this actually happens (and if it happens on ARM little cores, etc.)
Re:Why do arrays start at 0? by NohatCoder on Thursday August 25, 2022 @06:16AM (#32591756)
If it is not on the hot path, it is likely free, but not guaranteed. If it is on the hot path then it is wasting a whole cycle. And of course in highly ALU-dependent code it is another instruction, so a fraction of a clock.
Re:Why do arrays start at 0? by kaba0 on Thursday August 25, 2022 @08:23AM (#32592744)
What do you mean it wastes a whole cycle? It may indeed have worse performance due to blowing the instruction cache, but I don’t see why would out-of-order execution be slower on the hot path - I doubt there would be too many hot paths without any dependence on memory fetches outside specific benchmarks - the memory loads will take significantly more time even if they hit cache.