The programs on the pictures above print numbers from set {4*n | n ∈ [0; 31] ⋂ Z }
Both cycles do the same thing, but rust "for" cycle has more lines in the assembly code and works a bit slower
Why compiler does not optimize this "for" cycle to be as fast as "while" one?
Flags are -C opt-level=3 -C target-cpu=native
#"for" cycle optimization issue
3 messages · Page 1 of 1 (latest)
Program with "while" cycle:
https://godbolt.org/z/eKaWaPz59
Program with the "for" cycle:
https://godbolt.org/z/W1xbbe9E9