Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Alexey_I_N_
Beginner
188 Views

Code optimizations but small binary file

Jump to solution

Can i combine /Ox with /Os option?

0 Kudos
1 Solution
SergeyKostrov
Valued Contributor II
188 Views
>>...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 ).

View solution in original post

7 Replies
TimP
Black Belt
188 Views
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.
SergeyKostrov
Valued Contributor II
188 Views
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
Alexey_I_N_
Beginner
188 Views
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
Alexey_I_N_
Beginner
188 Views

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

SergeyKostrov
Valued Contributor II
188 Views
[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. ...
dpeterc
Beginner
188 Views
In my experience, for Qt based program, if you set -fno-exceptions -fno-inline it will help reducing executable size significantly.
SergeyKostrov
Valued Contributor II
189 Views
>>...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 ).

View solution in original post

Reply