Recently, our company started implementing a software package written by another company. This package allows us to receive and put away goods using online Radio Frequency (RF) technology. It is replacing batch processing.
We are taking great pains to identify inefficiencies in the application to improve performance. Here are a few tips I have found that may improve the response time of interactive programs. Many of these tips may not seem important, but I have noticed a big difference. Because of the online nature of the programs, any improvement helps.
1. When calculating a percentage, use the MULT op code instead of DIV whenever possible. We have a field in a file that is a percentage. Multiplying by .01 instead of dividing by 100 has noticeably improved the performance of our applications.
2. Our programs are using large element arrays (999 to 9,999 elements). Many times, they are being initialized back to zero or blanks. We slightly changed the code to only initialize those elements populated. This helped improve the response time.
8 shows an example of the type of change we made. X1 is a numeric field that contains the last element used. ARR is an array with 999 elements. With this slight change, the programs ran more efficiently and the same amount of work was done.
Figure 8 shows an example of the type of change we made. X1 is a numeric field that contains the last element used. ARR is an array with 999 elements. With this slight change, the programs ran more efficiently and the same amount of work was done.
3. While performing a lookup on an array of more than 200 elements, it may be quicker to eliminate the array by placing the data in a file and accessing it with a CHAIN operation. In our code, we have arrays with as many as 9,999 elements. The lookups were killing the system. Eliminate the array if you populate most of the elements, or backward fill the array if very few elements are populated.
4. Another consideration is the sheer amount of memory being consumed by extremely large arrays or data structures. Your system will do much more paging of memory if you have large arrays.
5. When doing nested IF processing or SELEC processing, place the IF/SELEC that is most likely to succeed first. This will reduce the number of tests the system is required to do. If we as programmers practice good techniques, then maybe someday we can avoid buying a processor upgrade. This is a fairly trivial thing, but when running a program that may be run thousands of times per day online, any savings in processing should be done.
6. Pay close attention to execution of code that does not have to take place. You have a report that reads a transaction file by part number and the file has many transactions per part number. The report has a description for each part number. CHAINing to the description file for each record is a waste of resources. Many extra lines of code are executed and many extra I/O operations take place. CHAIN to the description file only when a change in part number takes place.
This may seem trivial, but I have seen many programmers do this. This does not always take place in report programs, but in any program that is processing many similar items at a time.
- Bill Cressy
TechTalk: Performance Tips
Figure 8: Initializing an Array
Instead of coding this: *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 C Z-ADD*ZEROS ARR Code this: *. 1 ...+... 2 ...+... 3 ...+... 4 ...+... 5 ...+... 6 ...+... 7 C X1 DOWGT*ZERO C Z-ADD*ZEROS ARR,X1 C SUB 1 X1 C ENDDO
LATEST COMMENTS
MC Press Online