![]() |
|
| Ron Turull | |
Way, way back, when the news was filled with the upcoming release of OS/400 V2R1, a program manager at IBM told me that IBM already knew how to optimize programs "up the wazoo," they just didn't have the right environment on the AS/400 yet to implement it. That right environment that the IBMer was referring to was ILE, which we got a few years later. Since then we have been able to reap the rewards of program optimization. If you're not using it, now is the time for administrators to consider it, especially if your system is getting sluggish.
How to optimize your programs
Programs are optimized using the ILE optimizing translator. Access to the optimizing translator is provided by the OPTIMIZE parameter of the CHGPGM, CHGMOD, CHGSRVPGM, and the various ILE create module and create bound program commands (e.g., CRTRPGMOD and CRTBNDRPG).
Optimization is done at the module level. (That is why there is an OPTIMIZE parameter on the CHGMOD and CRTxxxMOD commands.) Each module is optimized as a separate entity with no cross-module optimization taking place. (There is a way to do inter-module optimization, but that is the subject of another article.) When an entire program is optimize (e.g., using the CHGPGM or CHGSRVPGM commands), every module in the program is optimized, but they are still optimized at the module level. That flexibility gives you the ability to optimize some modules in a program while keeping others intact, or optimizing different modules at different levels.
|
Three basic levels of optimization
There are three basic levels of optimization from which to choose:
- *NONE. No optimization is done, except for what is necessary in order to translate the module.
- *BASIC. Some basic optimization is done, but more dramatic optimization -- optimization that can (in very rare instances) cause program errors -- is not performed.
- *FULL. All optimization techniques are applied. While this optimization level produces the fastest running code, it can also, in rare circumstances, cause programs to fail (see The price of optimization below). There is a fourth level of optimization, but in addition to doing everything that *FULL optimization does, it simply disables trace data.
The chart below shows an example program optimized at these three different levels and the affect it has on the program run-time performance and object size. It should be noted that while this example shows object size decreasing with increased levels of optimization, sometimes that is not the case; object size often increases as higher levels of optimization are applied.
|
Optimization level |
Run time |
Object size |
|
*NONE |
559 |
49,664 |
|
*BASIC |
513 |
48,640 |
|
*FULL |
362 |
48,128 |
