Is the Release Build always faster than the Debug build (because, the release build is optimizing a lot)?, even if I write the fastest performance code possible?
Or is it possible to write C++ code (using debug) which is as fast as the Release Build?
I'm just curious if my code Is too slow, because I notice a respectable difference, when I do performance tests.
A good choice of algorithm definitely will make a big difference in speed of a debug build, but debug builds will never be as fast. It's because the optimizer schedules registers completely differently, trying to make code run fast, while the debug compiler tries to preserve values of temporary variables so you can read them from the debugger.
Since you probably have a lot more variables than CPU registers, this means the debug compiler will emit instructions to copy those values to RAM. While in a release build, if the value isn't used again, the optimizer will just throw it away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With