If i compile a C program with different options like '-o, -o2, -o3' Will there be any difference in the execution time or memory utilization?.
Asked
Active
Viewed 46 times
-1
-
There are profilers that will be able to measure all those things, so why not try it? Another way is to compare the generated code from the different executables. – Some programmer dude Dec 15 '16 at 12:27
1 Answers
1
Maybe.
Depends. You're telling the compiler to spend a bit of additional time into looking for places where it could probably optimize the code from the standard approach. It might find such places, but it also might not. On all but the most trivial programs, there is, however, quite a high probability the compiler will be able to optimize ("Hello World" doesn't optimize very well, though...).

tofro
- 5,640
- 14
- 31