What the optimization really does is use various algorithms to analyze your code in order to convert to the smallest, fastest machine code, at the cost of longer compilation. The default is
-o0
, which means no optimization at all. In turn, the code will compile quite fast, but might create a more bloated program. https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html has more on this. Also, be warned that debugging with 2 or 3 can be a real challenge if you are not used to compiling at that level. If you want code that can be debugged while being optimized, use