1. No. 2. No. 3. No. Those things are true most of the time, but not all of the time. Profiling and benchmarks are the tools I use to find out whether it's me or the compiler being stupid.
(Is this actually a reply to my godbolt example, or... ? Because it doesn't seem responsive.)
-
-
In your simple case, none of the points I mentioned applies, no. But on any real world code base, -O2 will optimize your code beyond just finding the closest ASM equivalent, and you are basing your performance on the compiler making smart decisions.
-
I'm very well aware that enabling -O3 is like gambling - you can win, you can lose. But we can't pat ourselves on the back for the great performance we get with -O2, there is a lot that the compiler did for us there.
End of conversation
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.