OPTIMIZE
- Default
- OPT(0)
- Recommended
- OPT(2)
- Reasoning
- Maximum level of optimization generally results in the fastest performing code to be generated
by the compiler.
For example, a suite of benchmark programs shows that compiling with OPT(1) is 31% faster than OPT(0), and OPT(2) is 1.8% faster than OPT(1).
- Considerations
OPT(2) compiles generally use more memory and take longer to complete compared to using OPT(1) or OPT(0).
Compile-time data gathered from a set of benchmarks show that on average OPT(1) takes 1.5 times longer than OPT(0), and OPT(2) takes 1.8 times longer than OPT(0) (comparing CPU time). For very large test cases, the compile-time trade off can be worse than the average.
In addition, debuggability can be reduced as compiler optimizations and dead code removal are more advanced at this setting.
The possible settings for the OPTIMIZE option changed between V4 and V5. V6 continues to use the new V5 settings. The meaning of those settings has not changed between V5 and V6.
Note that unreferenced level 01 and level 77 items are no longer deleted with this highest OPT setting as was the case in V4 with OPT(FULL). This means programs that could not use OPT(FULL) previously can specify OPT(2). See STGOPT for more information.
Although both V4 and V6 offer three levels of OPT specifications, the names and more importantly the underlying optimizations enabled have changed.
For example, an important difference between V4 and V6 is that the highest setting in V4 of OPT(FULL) was the suite of OPT(STD) optimizations plus the removal of unreferenced data items and the corresponding code to initialize their VALUE clauses.
In contrast, the highest setting in V6 is OPT(2) and this contains the suite of OPT(1) optimizations plus additional optimizations to improve performance, such as globally propagating values, sign state information and better register allocation for accessing indexed tables.
As detailed in OPTIMIZE in the Enterprise COBOL for z/OS® Programming Guide, the table of "Mapping of deprecated options to new options", the V4 OPT settings are currently tolerated, but none of the V4 settings map to OPT(2). For example, OPT(FULL) specified with V6 is mapped to OPT(1) and STGOPT.