8 ms·
Compilers are rarely going to transform the 1000/1000 example into the 10/10 one, even if they were smarter. Often such a transformation is simply impossible:
by BeeOnRope 9y ago
Compilers are rarely going to transform the 1000/1000 example into the 10/10 one, even if they were smarter.
Often such a transformation is simply impossible: the effect of interleaving the instructions may be different than what the source dictates.
Also the 1000/1000 example probably doesn't arise as a long stream of explicit instructions: it is probably just a short loop with 1000 iterations! That makes it even less likely that the compiler will simply start interleaving various instructions following the loop into the loop body somehow.