Code optimizations but small binary file

Code optimizations but small binary file

Can i combine /Ox with /Os option?

8 posts / 0 nouveau(x)
Dernière contribution
Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.

I suspect, if you set both options, the latter one will suppress the first. /Os for ICL was documented as generating the minimum size binary with no effort to gain performance. /O1 would produce a slightly larger binary with most performance optimizations, except for auto-vectorization.

Hi everybody,

>>...Can i combine /Ox with /Os option?

No and this is because /Ox ( Full Optimization ) will override any other optimization option /On. It is very easy to verify and a warning message, like: '...overriding '/O1' with '/Ox'', should be displayed.

Best regards,
Sergey

There are my test small program written on Qt 4:

/Os = 104 kb

/O2 = 114 kb
/O2 /Os = 105 kb
/Os /O2 = 105 kb

/O3 = 114 kb
/O3 /Os = 105 kb
/Os /O3 = 105 kb

/Ox = 116 kb
/Ox /Os = 112 kb
/Os /Ox = 112 kb

Quote:

Sergey Kostrov wrote:

Hi everybody,

>>...Can i combine /Ox with /Os option?

No and this is because /Ox ( Full Optimization ) will override any other optimization option /On. It is very easy to verify and a warning message, like: '...overriding '/O1' with '/Ox'', should be displayed.

Best regards,
Sergey

C:\Qt\qt-everywhere-opensource-src-4.8.3\examples\widgets\stylesheet>icl Intel(R) C++ Compiler XE for applications running on IA-32, Version 13.0.0.089 Build 20120731 In the course of the test (see results above) I have not received such messages

[SergeyK] I understood that you're on a Windows platform and here is a quote from 'Intel C++ compiler User and Reference Guides':
...
__ NOTE. On Windows systems, the /Od option is part of a mutually-exclusive group of
__ options that includes /Od, /O1, /O2, /O3, and /Ox. The last of any of these options
__ specified on the command line will override the previous options from this group.
...
[SergeyK] Please take a look at the document ( pdf or online ) because it has lots of details. For example, like:
...
__ The compiler enables maximum optimizations by combining the following options:
__ • /Ob2
__ • /Og
__ • /Oy
__ • /Ot
__ • /Oi
...
[SergeyK] In case of '/Os' option the document says:
...
This option enables optimizations that do not increase code size and produces smaller code
size than O2. It disables some optimizations that increase code size for a small speed benefit.
This option tells the compiler to favor transformations that reduce code size over transformations
that produce maximum performance.
...

In my experience, for Qt based program, if you set
-fno-exceptions -fno-inline
it will help reducing executable size significantly.

Best Reply

>>...In my experience, for Qt based program, if you set
>> -fno-exceptions -fno-inline
>>it will help reducing executable size significantly.
.
Another option to consider is a 'hand-based' code optimization. On some projects developers simply do not care how many C/C++ code lines they have and some simple algorithms look like monsters ( thousands of lines instead of hundreds lines ).

Connectez-vous pour laisser un commentaire.