@mratsim is probably intending to refer to the `..` including `50` in Nim while
the C `for` with a `<` excludes `50` doing about 2% less work, but the
terseness and style of of his comment may leave the wrong impression.
for i in 0..50: echo i
Run
indeed compiles down (in release mode) to simply:
NI res = ((NI) 0);
while (1) {
if (!(res <= ((NI) 50))) goto LA3;
res += ((NI) 1);
}
LA3: ;
Run
plus some stuff only related to my choice of `echo` for the body (which I
removed for clarity). Any decent optimizing C compiler should treat those two
ways to spell the loop (@mratsim's `for` and the above `while`) the same.
TL;DR the extra time is from the bounds of the iteration, not the language or
iterator overhead.