











C Compiler OptimizationLevel 3
Performs all level 2 features, PLUS:
Removes all uncalled functions
Simplifies functions that have unused return values
Expands calls to small functions inline
Identifies file-level variable characteristics
Notes:
Level 3 optimization performs all the optimizations of levels 0, 1, and 2 plus more, focusing on subroutines and calls.
Uncalled functions are removed, and functions with unused return values are simplified. For instance, if you have a function that you've compiled and linked, it's part of the code. If it's never called, the optimizer will discard it reducing the code size.
If we have a short function such as one which takes absolute value of a number, rather than call a subroutine, utilize the stack, and add the overhead associated with a subroutine call, this optimization will simply make that function an in-line set of statements. This eliminates the overhead associated with the subroutine. If this is done a lot, code size would increase noticeably, so there are always tradeoffs depending on the particular desired characteristics of the final program, but the optimizations can substantially improve performance.