Skip to content

Links dump for GCC optimization options.



Code optimization by using GCC options is the oldest trick programmer’s
fallback to whenever the program size or speed improvements are expected.
I was also in search of some easy gains in speed & size. Hence started the
research to understand the various GCC options for compile time
optimizations.

I am not going to list the options, but will dump the links that provided
me the information.
The articles themselves are sometimes dated, but the information is
nonetheless useful.
So here they are :
1. http://www.network-theory.co.uk/docs/gccintro/gccintro_49.html
2. http://gcc.gnu.org/onlinedocs/gcc-3.3.4/gcc/Optimize-Options.html
3. http://www.linuxjournal.com/article/7269?page=0,0
4.http://software.intel.com/en-us/blogs/2013/01/17/x86-gcc-code-size-optimizations

TLDR : -O2 = default best and safe optimisation option, -Os = optimizes in
size and (probably) speed as well, -O3 = slowest compilation, may not give
speed gains.