Optimizing your code
When your program is ready for final testing, specify
the OPTIMIZE(1|2)
compiler option
so that the tested code and the production code are identical. Note that IBM® recommends
that all users use OPT(2)
for the best performance.
About this task
If you frequently run a program
without recompiling it during development, you might also want to
use OPTIMIZE(1|2)
. However,
if you recompile frequently, the overhead for OPTIMIZE(1|2)
might outweigh
its benefits unless you are using the assembler language expansion
(LIST
compiler option) to fine-tune the program.
For unit-testing a program, you will probably find it easier to debug code that has not been optimized.
To see how the optimizer
works on a program, compile it with different
levels of optimization and compare the generated code. (Use the LIST
compiler
option to request the assembler listing of the generated code.)