-O(-Os, -Ot): Main Optimization Target

Group

OPTIMIZATIONS

Scope

Function

Syntax
  -O(s|t)
  
  
Arguments

s: Optimize for code size (default)

t: Optimize for execution speed

Default
  -Os
  
  
Defines

  __OPTIMIZE_FOR_SIZE__
  
  
  
  __OPTIMIZE_FOR_TIME__
  
  
Pragmas

None

Description

At times the Compiler must choose between generating fast, large code, or slow, small code.

The Compiler generally optimizes on code size. It often decides between a runtime routine or expanded code. The programmer can decide whether to choose the slower and shorter or the faster and longer code sequence by setting a command line switch.

The -Os option directs the Compiler to optimize the code for smaller code size. The Compiler trades faster/larger code for slower/smaller code.

The -Ot option directs the Compiler to optimize the code for faster execution time. The Compiler trades slower/smaller code for faster/larger code.

Note: This option only affects some special code sequences. Set this option together with other optimization options (such as register optimization) to get best results.
Example
  -Os