Sunday, 11 August 2013

COBOL OPTIMIZE Compiler Option.

To assist in the optimization of the code, you should use the OPTIMIZE compiler option. With the OPTIMIZE(STD) or OPTIMIZE(FULL) options in effect, you may receive optimizations that include:
  • eliminating unnecessary branches simplifying inefficient branches
  • simplifying the code for the out-of-line PERFORM statement, moving the performed paragraphs in-line, where possible
  • simplifying the code for a CALL to a contained (nested) program, moving the called statements in-line, where possible
  • eliminating duplicate computations
  • eliminating constant computations
  • aggregating moves of contiguous, equal-sized items into a single move
  • deleting unreachable code
Additionally, with the OPTIMIZE(FULL) option in effect, you may also receive these optimizations:
  • deleting unreferenced data items and the associated code to initialize their VALUE clauses
Many of these optimizations are not available with OS/VS COBOL, but are available with IBM Enterprise COBOL. NOOPTIMIZE is generally used while a program is being developed when frequent compiles are necessary.
NOOPTIMIZE also makes it easier to debug a program since code is not moved; NOOPTIMIZE is required when using the TEST compiler option with a value other than TEST(NONE).
OPTIMIZE requires more CPU time for compiles than NOOPTIMIZE, but generally produces more efficient run-time code. For production runs, OPTIMIZE is recommended.
Performance considerations using OPTIMIZE:
On the average, OPTIMIZE(STD) was 1% faster than NOOPTIMIZE, with a range of 12% faster to equivalent.
On the average, OPTIMIZE(FULL) was equivalent to OPTIMIZE(STD).
One RENT program calling a RENT subprogram with 500 unreferenced data items with VALUE clauses was 9% faster with OPTIMIZE(FULL) or OPT(STD) compared to NOOPT.
The same RENT program calling a RENT subprogram with 500 unreferenced data items with VALUE clauses using the IS INITIAL clause on the PROGRAM-ID statement was 90% faster with OPTIMIZE(FULL) compared to OPT(STD).

Created with Artisteer

No comments:

Post a Comment