TechTalk: Performance Tips

Typography
  • Smaller Small Medium Big Bigger
  • Default Helvetica Segoe Georgia Times

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 
BLOG COMMENTS POWERED BY DISQUS

LATEST COMMENTS

Support MC Press Online

$

Book Reviews

Resource Center

  •  

  • LANSA Business users want new applications now. Market and regulatory pressures require faster application updates and delivery into production. Your IBM i developers may be approaching retirement, and you see no sure way to fill their positions with experienced developers. In addition, you may be caught between maintaining your existing applications and the uncertainty of moving to something new.

  • The MC Resource Centers bring you the widest selection of white papers, trial software, and on-demand webcasts for you to choose from. >> Review the list of White Papers, Trial Software or On-Demand Webcast at the MC Press Resource Center. >> Add the items to yru Cart and complet he checkout process and submit

  • SB Profound WC 5536Join us for this hour-long webcast that will explore:

  • Fortra IT managers hoping to find new IBM i talent are discovering that the pool of experienced RPG programmers and operators or administrators with intimate knowledge of the operating system and the applications that run on it is small. This begs the question: How will you manage the platform that supports such a big part of your business? This guide offers strategies and software suggestions to help you plan IT staffing and resources and smooth the transition after your AS/400 talent retires. Read on to learn: