#OPTIMIZE

The #OPTIMIZE compiler command causes the compiler to perform certain optimizations with respect to generated code. Do not use this compiler command unless there is an explicit need to override the environment default.

Syntax

#OPTIMIZE condition ON|OFF

Parameters

condition

One or more conditions, separated by commas, that identify the type of optimization that should occur. The default is all conditions. Valid conditions include:

  • OBJECTS - Causes the compiler to recognize short-lived type Record objects and, if possible, does not physically allocate or manage object storage. This "lightweight" instantiation is transparent to application logic but significantly reduces run-time overhead associated with array handling, string copying, and symbol table management.

    If a block of code is only used within a single subroutine, it should reside within that subroutine, using nested logic, if appropriate. The #OPTIMIZE command works well in this situation, and the actual code execution (net of PSL) is significantly faster if the code is adjacent, rather than in a separate label or program.

  • FUNCTIONS - Causes the compiler to translate function calls into object method calls for a selected number of M intrinsic functions and pre-PSL utility functions as defined in the STBLPSLFUNSUB table.

ON|OFF

An indication of whether the compiler should optimize. The default #OPTIMIZE action is ON. However, if #OPTIMIZE is not included in the PSL code (implicity through UCOPTS or explicitely), the optimizer will not be invoked.

When Became Available

Profile v6.3

Example

TRNDRV // Profile Transaction driver

//

#WARN

 

// turn all optimization on (FUNCTIONS,OBJECTS)

#OPTIMIZE

#OPTIMIZE FUNCTIONS,OBJECTS

#OPTIMIZE FUNCTIONS,OBJECTS ON

 

// turn optimization of FUNCTIONS off

#OPTIMIZE FUNCTIONS OFF

 

// turn optimization of OBJECTS on

#OPTIMIZE OBJECTS

#OPTIMIZE OBJECTS ON