Compiler Optimization in the different CMakeConfigs

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Compiler Optimization in the different CMakeConfigs

Mariano Martinez Peck
 
Hi guys. Unix and Windows confs have -O2. However, in Mac, the Carbon ones have -O3 y the cocoa ones -Os.
As far as I know -Os is for size, so we really don't care about that (unless we are in a mobile device). So, is there a reason why Unix and Windows use -O2 and Mac -O3 ?  should we chage this?  which should we use?

Thanks in advance,

--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Compiler Optimization in the different CMakeConfigs

Mariano Martinez Peck
 
Sorry, I forgot to say..and for the "debug" release, Unix and Windows use -O1 instead of -O1 which is the one used by Mac confs...is this correct?

Is it safe to debug using -O1 instead of -O0?

thanks

Mariano

On Tue, Apr 19, 2011 at 11:13 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys. Unix and Windows confs have -O2. However, in Mac, the Carbon ones have -O3 y the cocoa ones -Os.
As far as I know -Os is for size, so we really don't care about that (unless we are in a mobile device). So, is there a reason why Unix and Windows use -O2 and Mac -O3 ?  should we chage this?  which should we use?

Thanks in advance,

--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Compiler Optimization in the different CMakeConfigs

Eliot Miranda-2
 


On Tue, Apr 19, 2011 at 2:19 PM, Mariano Martinez Peck <[hidden email]> wrote:
 
Sorry, I forgot to say..and for the "debug" release, Unix and Windows use -O1 instead of -O1 which is the one used by Mac confs...is this correct?

Is it safe to debug using -O1 instead of -O0?

No.  If you want to be able to debug everything reliably then you need to use -O0.  
 

thanks

Mariano

On Tue, Apr 19, 2011 at 11:13 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys. Unix and Windows confs have -O2. However, in Mac, the Carbon ones have -O3 y the cocoa ones -Os.
As far as I know -Os is for size, so we really don't care about that (unless we are in a mobile device). So, is there a reason why Unix and Windows use -O2 and Mac -O3 ?  should we chage this?  which should we use?

Thanks in advance,

--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com



Reply | Threaded
Open this post in threaded view
|

Re: Compiler Optimization in the different CMakeConfigs

Eliot Miranda-2
In reply to this post by Mariano Martinez Peck
 


On Tue, Apr 19, 2011 at 2:13 PM, Mariano Martinez Peck <[hidden email]> wrote:
 
Hi guys. Unix and Windows confs have -O2. However, in Mac, the Carbon ones have -O3 y the cocoa ones -Os.
As far as I know -Os is for size, so we really don't care about that (unless we are in a mobile device). So, is there a reason why Unix and Windows use -O2 and Mac -O3 ?  should we chage this?  which should we use?

Use what works based on testing and field experience.  I expect everything is there for a reason. IIABDFI (if it ain't broke don't fix it).  If you can produce a comprehensive stress test then you can experiment with different optimization levels.  If you can't you're on thin ice changing them.

Further, at least in Cog the speed of the VM (as opposed to plugins) is much less dependent on the level of compiler optimization used since that has no effect on the code the Cogit generates.  BTW, often -Os gets good speed since compact code can often be fast code, at least in systems without huge inner loops where there's little opportunity for loop-unrolling and inlining to make much difference.  Bloated code can have poor cache performance.  On current processors, hugely fast relative to memory speed, unless you're talking about media streaming algorithms inlining and loop unrolling is a dubious optimization to apply.  hence I would stick with -Os or -O2 for the core VM and choose more aggressive settings for selected plugins.

hope this makes sense
Eliot


Thanks in advance,

--
Mariano
http://marianopeck.wordpress.com



Reply | Threaded
Open this post in threaded view
|

Re: Compiler Optimization in the different CMakeConfigs

Mariano Martinez Peck
In reply to this post by Eliot Miranda-2
 


On Wed, Apr 20, 2011 at 9:25 PM, Eliot Miranda <[hidden email]> wrote:
 


On Tue, Apr 19, 2011 at 2:19 PM, Mariano Martinez Peck <[hidden email]> wrote:
 
Sorry, I forgot to say..and for the "debug" release, Unix and Windows use -O1 instead of -O1 which is the one used by Mac confs...is this correct?

Is it safe to debug using -O1 instead of -O0?

No.  If you want to be able to debug everything reliably then you need to use -O0.  
 

Yes, exactly. That's why I asked. Some debug confs in CMakeVMMaker  have -O1 ... so I will change them to -O0.
Thanks Eliot
 

thanks

Mariano

On Tue, Apr 19, 2011 at 11:13 PM, Mariano Martinez Peck <[hidden email]> wrote:
Hi guys. Unix and Windows confs have -O2. However, in Mac, the Carbon ones have -O3 y the cocoa ones -Os.
As far as I know -Os is for size, so we really don't care about that (unless we are in a mobile device). So, is there a reason why Unix and Windows use -O2 and Mac -O3 ?  should we chage this?  which should we use?

Thanks in advance,

--
Mariano
http://marianopeck.wordpress.com




--
Mariano
http://marianopeck.wordpress.com







--
Mariano
http://marianopeck.wordpress.com

Reply | Threaded
Open this post in threaded view
|

Re: Compiler Optimization in the different CMakeConfigs

Mariano Martinez Peck
In reply to this post by Eliot Miranda-2
 


On Wed, Apr 20, 2011 at 9:30 PM, Eliot Miranda <[hidden email]> wrote:
 


On Tue, Apr 19, 2011 at 2:13 PM, Mariano Martinez Peck <[hidden email]> wrote:
 
Hi guys. Unix and Windows confs have -O2. However, in Mac, the Carbon ones have -O3 y the cocoa ones -Os.
As far as I know -Os is for size, so we really don't care about that (unless we are in a mobile device). So, is there a reason why Unix and Windows use -O2 and Mac -O3 ?  should we chage this?  which should we use?

Use what works based on testing and field experience.  I expect everything is there for a reason. IIABDFI (if it ain't broke don't fix it).  If you can produce a comprehensive stress test then you can experiment with different optimization levels.  If you can't you're on thin ice changing them.

Further, at least in Cog the speed of the VM (as opposed to plugins) is much less dependent on the level of compiler optimization used since that has no effect on the code the Cogit generates.  BTW, often -Os gets good speed since compact code can often be fast code, at least in systems without huge inner loops where there's little opportunity for loop-unrolling and inlining to make much difference.  Bloated code can have poor cache performance.  On current processors, hugely fast relative to memory speed, unless you're talking about media streaming algorithms inlining and loop unrolling is a dubious optimization to apply.  hence I would stick with -Os or -O2 for the core VM and choose more aggressive settings for selected plugins.


Thanks Eliot for the explanations. In fact I don't have any kind of test not experiment to check whether we should use -O2, -Os, etc. I just asked because I saw different values for different OS and I was just curious. So...since my knowledge is quite limited, I will let everything as it is.

Thanks again

Mariano

 
hope this makes sense
Eliot


Thanks in advance,

--
Mariano
http://marianopeck.wordpress.com







--
Mariano
http://marianopeck.wordpress.com