Optimizing Method Code

PSL compiler state information and literal parameter data can be used effectively to eliminate run-time schema and database lookups; resolve variables at compile time; and trim generated code paths at compile time. As a rule, if a value can be resolved at compile time (i.e., it is available at compile time and the logic determines that it will never change at run time), do so. Use the same technique for code paths. For example, if the method references a table that does not contain BLOBS and the table is a literal value, do not generate code to deal with BLOBS. Also, do not generate any run-time code to reference the table in the schema. Instead, do it all at compile time.

In some cases, it is possible to optimize method code after PSL has passed the entire program and all the method calls are resolved; all the subroutines are identified; and all the call paths are identified. This optimization occurs in various ways.