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
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
So here they are :
TLDR : -O2 = default best and safe optimisation option, -Os = optimizes in
size and (probably) speed as well, -O3 = slowest compilation, may not give