Why is there a "continue" at all in the first code sample?
Edit to add: does removing it make any difference?
Edit to add: does removing it make any difference?
As other comments point out, this construct can be replaced by a cmov instruction:
if a > b:
b = a
The following construct however, cannot be replaced by cmov: if a > b:
b = a
continue
Only by first eliminating the pointless "continue" is this replacement valid. But by including it, you can make it look like it's the 'print("lol")' is what makes the difference, which is only true lexically.https://godbolt.org/z/ds1raTYc9
https://godbolt.org/z/rbWsxM83b
The `print("lol")` output looks remarkably different.
It is there only to match the continue in the second code sample, where it is needed.
I'm curious if the performance difference noted in the article happens on Intel/AMD as well...