4 ms·
The excuse for this is that performance is not considered part of the behavior of the program. So it doesn't matter to the question of whether your program is d
by rocqua 2y ago
The excuse for this is that performance is not considered part of the behavior of the program. So it doesn't matter to the question of whether your program is deterministic.
- glitchc 2y agoExcept for the fact that performance optimization frequently does change the behaviour of the program.
- mrob 2y agoIf performance optimization changes anything other than performance it's either a bug in the program or a bug in the compiler.
- naasking 2y agoYes, but program bugs are obviously very, very common. Developers already do a great job of adding bugs to their programs, they don't need compilers compounding that problem in non-deterministic ways.
- rocqua 2y agoThat is only possible if the optimization is wrong (rare), or the program already had undefined behavior (very common, because undefined behavior is very easy to trigger in C).
- glitchc 2y agoI'll give an example: -ffast-math. There's extensive literature out there on how fast-math changes the behaviour of code. I've been bitten by this a couple of times already.
- bluGill 2y agoThese days you don't know what cpu you run on so you can't make performance guarentees anyway. Even in embedded we have been burn with the only cpu going out of production enough to not depend on it anymore in most cases.