To balance the tradeoff between code size and speed, use the --opt_for_speed option. The level of optimization (0-5) controls the type and degree of code size or code speed optimization:
Optimizes code size with a high risk of worsening or impacting performance.
Optimizes code size with a medium risk of worsening or impacting performance.
Optimizes code size with a low risk of worsening or impacting performance.
Optimizes code performance/speed with a low risk of worsening or impacting code size.
Optimizes code performance/speed with a medium risk of worsening or impacting code size.
Optimizes code performance/speed with a high risk of worsening or impacting code size.
If you specify the --opt_for_speed option without a parameter, the default setting is --opt_for_speed=4. If you do not specify the --opt_for_speed option, the default setting is 2
The older mechanism for controlling code space, the --opt_for_space option, has the following equivalences with the --opt_for_speed option:
--opt_for_space | --opt_for_speed |
---|---|
none | =4 |
=0 | =3 |
=1 | =2 |
=2 | =1 |
=3 | =0 |
A fast branch (BF) instruction is generated by default when the --opt_for_speed option is used. When --opt_for_speed is not used, the compiler generates a BF instruction only when the condition code is one of NEQ, EQ, NTC and TC. The reason is that BF with these condition codes can be optimized to SBF. There is a code size penalty to use BF instruction when the condition code is NOT one of NEQ, EQ, NTC and TC. (Fast branch instructions are also generated for functions with the ramfunc function attribute.)
The --no_fast_branch option is deprecated and has no effect.