gtpa2m3s | Application Programming |
TPF application and system programmers must remain aware of the need to
make their programs perform efficiently. Evaluate every routine against
this objective. Some compromises are to be considered, such as coding
productivity, simplicity, ease of understanding and modifying--but
performance must always be a primary factor.
The most productive area for improving performance is in minimizing file
accesses. The main focus for this, of course, is the data structure
itself and the method by which the program accesses its data. Other
factors, however, are directly controlled by program design and are therefore
in the hands of the individual programmer.
- Develop conventions for procedures for using records shared by multiple
programs, including the ECB data levels or data event control blocks (DECBs)to
be used. When possible, these records should be kept in main storage
and passed via the ECB from program to program--not filed by program A,
then retrieved by program B. It was suggested in an earlier section
that it is important to release system resources, such as main storage blocks,
as early as possible. However, that determination must be made in terms
of the total processing for the entry, not just in the logic of each program
segment.
In a multiple processor (I-stream) environment, programmers must also be
aware of shared main storage resources and should minimize their use.
When required to access a shared resource, appropriate multiprocessing
techniques must be used. See TPF Concepts and
Structures for additional discussion of multiprocessing.
Early development of conventions on data level use also will allow all
programs to be coded with specific records on the conventional level, thus
avoiding excessive use of the attac and detac
functions.
- Do not file records without determining that they, in fact, have been
updated. Set an indicator when you update the record, and file only if
the indicator is set.
- Do not file partial updates of a record. Complete all updates, then
file the record once.
- Hold file records only for as long as required for a complete
update: holding file records can be a significant performance
bottleneck. If the update is complete but the entry still requires the
data block, file the block without releasing it (filnc), and then
unhold it (unfrc). The data block may then be retained as
long as necessary without serious system impact.
- Note:
- You can use DECBs for passing data between programs without using ECB data
levels. For more information, see Data Event Control Blocks.
Other performance-oriented suggestions:
- For areas where fast performance is most critical, consider using low
level C functions, if they are available. For a 1-time use it may not
seem significant, but consistent use of the most efficient instructions can be
productive.
- Evaluate moving and clearing operations. Do not clear work blocks
unless necessary, and then choose efficient methods.
- Evaluate different table search techniques; under some conditions a
binary search can be dramatically faster than a serial search.