views:

30

answers:

2

hi, If I understand correctly then the release mode enables a program to run faster than running the program in debug mode.

A general question will be if one has to run the program first in debug mode and then switch to run the program in release mode in order for the release mode to "skip over" checks it normally makes when running in debug mode? Or is one able to run directly a program in release mode right at the start?

Now when it comes to AdaGide, I see the option debug mode and release mode under Compile. Is placing a check mark next to release mode is all that's required to have AdaGide run the program in release mode? I'm using the GNAT GPL compiler.

Thanks a lot...

+1  A: 

You can't run a release program in debug mode. Code can be compiled with debugging symbols and status messages, or it can be compiled without them. If code is compiled in debug mode, it will run more slowly and take up more space; if it is compiled in release mode, it will run quickly and be more compact. Once the code has been compiled, its mode can't be changed.

I'm not familiar with AdaGide or the GNAT compiler, but I'd assume that if you check the "Release Mode" box, the code will be compiled in release mode.

Evan Kroske
Thanks for your answer also.
yCalleecharan
+1  A: 

Disclaimer: I'm not familiar with the specifics of AdaGide's release and debug modes.

Generally speaking, though...

Debug mode is when at least the debug flag (-g) is passed to the compiler so that the generated object files will retain symbol information for use by the debugger. It may pass other options, such as -gnata, that enables assertions, and the binder -E option used to store the callback stack in exceptions.

Unless you employ a lot of assertions (pragma Assert) there's not likely to be a significant difference in terms of performance between debug and release modes. The object files and executables for the debug version will, though, likely be significantly larger due to retaining the symbol information.

It's possible that release mode might disable runtime checks--which would potentially have a noticeable performance impact, but doing that as part of a nominal "release" mode would almost always be a very bad thing to do in Ada. As a general practice, one disables runtime checks only when performance requirements demand it, only where it materially affects performance, and only after those code sections have been formally proved and/or exhaustively tested and verified for correct execution.

The optimization options, -O2 and so on, will more materially affect performance, though the final amount depends on how one's code is structured and executed. YMMV.

Marc C