Hi All,

From the GCC manual, its clear that optimization options from –O1 to
–O3 or any greater level emphasis On the performance while –Os
emphasis only on the code size, it (-Os) says nothing about the
performance (execution time).

In our case : Size in case of –Os is less than that in case of –O4
that is according to the
manual  but the performance is also better in –Os case. So, Can we
predict something like that the performance in case of –Os will always
be better than that is in –O4 or it is just undefined (Can be better
or worse)

Following is according to the manual:

-O2 :   GCC performs nearly all supported optimizations that do not
involve a space-speed tradeoff. Also it deos not  Perform
finline-functions, -funswitch-loops and -frename-registers options.
(which are basically for Function Inlining, loop unrolling and
register renaming)

-O3 [-O4]:    Turns on all optimizations specified by -O2 + Function
Inlining, loop unrolling and register renaming

-Os :    enables all -O2 optimizations that do not typically increase
code size and also performs further optimizations  designed to reduce
code size

Any help is greatly appreciated.

--
Thanks,
Inder

Reply via email to