Why not? It clearly doesn't add anything meaningful to the run time, and helps avoid the question of whether the loop got optimised out.
I timed his code on Windows and it certainly adds to the runtime. To prevent the loop from being optimized out I created a pre-sized vector to index the ith ouput and print it outside the timed scope.
I have worked in the game industry and have many bad experiences with printf/logging consuming so much performance it makes games unplayable.
For a simple example, surely the easiest/safest way to make sure the loop remains a loop, is to look at the assembler output?
`printf` implements a barrier which cannot be crossed by an optimizer.
Meh. Aras is comparing apples to apples, so I don't see how it matters.
I agree its a general nitpick but it actual furthers Aras point if he removed the printf and the difference in performance (c-style vs ranges) was to increase.