Debug vs Release

What are the explicit differences between Debug and Release builds as they pertain to openFrameworks? I’m assuming with a Release build you 1) don’t have debug symbols 2) have a smaller build and 3) perhaps have slightly more efficient code as well. I’ve garnered these assumptions from my basic understanding of the concepts of debug vs release, but what is actually going on under the hood with OF? Also, are these differences platform/IDE dependent?

there tends to be slight differences per platform although we are working to get things more consistent (some discussion about this is here https://github.com/openframeworks/openFrameworks/issues/1022). your assumptions are generally correct – it’s:

  • debug add debugging symbols (which helps the debugger show you where you code crashes, or stops the code on breakpoint, etc). I think, at least how it looks in xcode, is that it’s stripping debug symbols for release, but same difference. Debug = has symbols. Release = no symbols
  • compiler flags. the compiler has different flags you can give it, produce the fastest code, produce the smallest exe, etc. For release we turn the flags way up to make the code fast, but don’t use optimizations for debug in order to keep things simple. This is why you will usually see jumps in performance for cpu bound tasks.
  • other optimizations. there’s sometimes other features beyond compiler settings, things like “unroll loops”, etc that help speed up code but make debugging harder. We usually have a set of these enabled for release.

you can poke around the project settings to compare if it’s helpful. I think knowing about compiler flags is super useful – it’s one thing that using an IDE sort of obscures, it’s feels helpful to see what’s going on under the hood:

1 Like

Another thing you can reference is the different things that happen given the Optimization Levels (-O2, -O3)

https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html

There will be differences between platforms and IDEs as they all use different compilers. For instance Clang may be better at inlining a certain function where VS2010 may decide to treat it differently.

1 Like

Thanks @zach and @jvcleave for the quick and detailed responses! Great resources for learning :smile:.