Release, MinSizeRel and RelWithDebInfo

Get answers to all your basic programming questions. No Ogre questions, please!
Post Reply
User avatar
LJS
Greenskin
Posts: 138
Joined: Wed Jan 09, 2013 8:58 pm
x 6

Release, MinSizeRel and RelWithDebInfo

Post by LJS »

What is the difference between the Release, MinSizeRel and RelWithDebInfo. The latter is quite self explainory but the former two, would it make any difference and if so, how?

R,
(am very clumbsy, especially with words on a static screen.)
Ogre 3D 1.9.0 static
Bullet 2.8 static
User avatar
Klaim
Old One
Posts: 2565
Joined: Sun Sep 11, 2005 1:04 am
Location: Paris, France
x 56
Contact:

Re: Release, MinSizeRel and RelWithDebInfo

Post by Klaim »

I believe that Release is the equivalent of what Visual Studio default Release configuration is. So basically, it just provide speed optimization and no debug info.

I believe that MinSizeRel is the same than Release but the optimization configuration is setup for making the smallest binary size. For example, this propably change how the compiler will interpret inlining, to focus on producing less code. This is only useful in cases where you need the binary to be as small as possible (but you will then probably have to setup a set of very specific compilation flags in addition).

RelWithDebInfo is Release with debug info as you already have guessed.

There could be MaxSpeedRel that would optimize for speed more agressively than Release, even if it makes the binary size explode, but that makes not much sense because the binary size also impact the execution speed. So Release is a good default compromise (high performance, binary not too big) for shipping product.
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Release, MinSizeRel and RelWithDebInfo

Post by Kojack »

Rather than MinSizeRel I'd just run UPX over the exe and dlls.
User avatar
LJS
Greenskin
Posts: 138
Joined: Wed Jan 09, 2013 8:58 pm
x 6

Re: Release, MinSizeRel and RelWithDebInfo

Post by LJS »

It must be true what they say: "It takes a good dictionairy to read a good dictionairy correctly.", so have searched for UPX on bing.

As it states it compresses the dll (and decrompressing it without memory overhead). Since my by far near to full hdd can take a dll 100x bigger, doesn't matter which you seek as an example. Are there other reasons why a smaller dll is better?

P.S. assuming this goes for an executable with external media too.
(am very clumbsy, especially with words on a static screen.)
Ogre 3D 1.9.0 static
Bullet 2.8 static
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Release, MinSizeRel and RelWithDebInfo

Post by c6burns »

Systems with limited resources, like embedded environments. Or systems where many processes will all use the same shared library. These are situations where shared library size starts to matter.
User avatar
LJS
Greenskin
Posts: 138
Joined: Wed Jan 09, 2013 8:58 pm
x 6

Re: Release, MinSizeRel and RelWithDebInfo

Post by LJS »

Thanks to you all.

R,
(am very clumbsy, especially with words on a static screen.)
Ogre 3D 1.9.0 static
Bullet 2.8 static
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Release, MinSizeRel and RelWithDebInfo

Post by c6burns »

c6burns wrote:Or systems where many processes will all use the same shared library.
You know I wasn't thinking straight. Above is a case where static library size really matters, because each process will need to load the static lib into memory. Shared libs are ... well ... shared between processes :oops:

Anyway along with embedded systems I would say console development can sometimes constrain how large your libs are. I never dev'd for PS3 but apparently squeezing libraries onto SPUs was an interesting game of whackamole
User avatar
LJS
Greenskin
Posts: 138
Joined: Wed Jan 09, 2013 8:58 pm
x 6

Re: Release, MinSizeRel and RelWithDebInfo

Post by LJS »

For those who can't read, LJS spells NOOB, as you clearly can see :wink: .

You know good documentation where I can read more about the dynamic and statically libraries, and shared libraries (of which I am starting to think they are either dynamic or static). I mean - I'll use Ogre as example -, when I link statically (OgreMainStatic.lib) I can run the executable on a different machine without any .lib or .dll (not taking cg into account). On the other hand, when linking my project with OgreMain.dll (or any .dll), I also need to link to a small static library (OgreMain.lib) and I can run the executable as long the .dll is at the other machine too.

Would the latter (OgreMain.lib) be a shared static library and the first (OgreMainStatic.lib) 'just' a static library?

R,
(am very clumbsy, especially with words on a static screen.)
Ogre 3D 1.9.0 static
Bullet 2.8 static
User avatar
c6burns
Beholder
Posts: 1512
Joined: Fri Feb 22, 2013 4:44 am
Location: Deep behind enemy lines
x 138

Re: Release, MinSizeRel and RelWithDebInfo

Post by c6burns »

.dll (dynamic link library) have an accompanying .lib, but the .dll itself is only loaded at runtime. static libraries put everything in the .lib and it's all mapped into your executable at compile time.

Pretty much everything you ever needed to know is on this page, or is linked from this page:
http://en.wikipedia.org/wiki/Library_%28computing%29
User avatar
LJS
Greenskin
Posts: 138
Joined: Wed Jan 09, 2013 8:58 pm
x 6

Re: Release, MinSizeRel and RelWithDebInfo

Post by LJS »

Thank you c6burns, have removed my insecurities about libs.

R,
(am very clumbsy, especially with words on a static screen.)
Ogre 3D 1.9.0 static
Bullet 2.8 static
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: Release, MinSizeRel and RelWithDebInfo

Post by Kojack »

UPX of ogre 1.9 results in a bin directory of 8.6MB instead of 27MB. That's not bad.
If you don't have fast hard drives, it can speed up loading too, since it's decompression is extremely fast (fast decompression can beat slow hard drives).
User avatar
LJS
Greenskin
Posts: 138
Joined: Wed Jan 09, 2013 8:58 pm
x 6

Re: Release, MinSizeRel and RelWithDebInfo

Post by LJS »

If a ratio of ~33% is 'not bad' then I need to redefine my interpretation of words :wink:

Is my assumption right: "Decompressed remains in memory, so that way there isn't any loss in speed at runtime.".
(am very clumbsy, especially with words on a static screen.)
Ogre 3D 1.9.0 static
Bullet 2.8 static
Post Reply