3 ms·
I'm not a compiler writer, just a programmer that tries to understand the transformations the compiler is capable of. -O0 is close to what you want. For hand o
by gpderetta 2y ago
I'm not a compiler writer, just a programmer that tries to understand the transformations the compiler is capable of.
-O0 is close to what you want. For hand optimized code there isn't a huge difference between the various optimization levels, but for higher level code C++ code, the difference between -O0 and -O3 are sometimes one or two orders of magnitude.
And yes, not all, or even most, optimizations apply to all programs. All loop optimizations are really most relevant for numerical, vectorizable code; branchy pointer-chasing code won't benefit from them. Branchy code can benefit from other optimizations though that can bring their own issues.