I am learning about gcc optimization. As far as I understand the compilers tries to improve/ reduce the code.
That is noticeable when I execute different files with different optimization levels. Adding -O3
during compiling I get the fastest result when I run the compiled program.
As it has been improved, I thought the assembly files must have less commands. However, when looking into that files I saw that it has even more than the default one.
- Is it true that the assembly file will have more commands, nevertheless it is running faster than the other one? If yes, how is that possible? What has been improved?
- What is the general influence on assembly / object files when using optimization flags in gcc?