Previous Topic Next topic Print topic


Performance Programming

There are many ways that an application can be configured in order to affect its performance, with the goal being to achieve the most optimized application at run time. By optimized, this usually means that the application executes more rapidly, or is capable of operating with less memory storage or using fewer resources, or that it draws less power from the CPU.

Generally, improvements in one of these elements can come at a cost to another - an application may be optimized to run quicker, but in doing so, may use more memory in the process. Carefully consider what you hope to achieve when optimizing your application, as it will affect the types of optimizations you will apply.

Often, the biggest effect on performance comes from having good algorithms or logic in your code, and using the correct data structures for those operations. Something as simple as ensuring that you use integer arithmetic (as opposed to floating point) can produce big gains in performance. The Optimizing COBOL Syntax and Optimizing PL/I Syntax sections demonstrate many good practices that will help you optimize your code.

Compilation is another area of an application that can be optimized. During the debug phase of your development, you are going to have certain diagnostics switched on, which will affect performance but are necessary to step through your code to debug it. When compiling your production version of the application, you will want to turn some, if not all, diagnostics off.

Tip: Whilst it is true that an application configured with diagnostics switched off will be more optimized, it may also be of benefit to run with some diagnostics switched on. This is so that unexpected problems can be investigated when they first occur. Diagnostics consume resources, and there is always contention between problem determination facilities and performance. You need to decide how important it is to be able to diagnose a problem the first time it occurs rather than having to try to recreate it or having to just turn on diagnostics and wait for it to re-occur.

When compiling your production version, it is also important to think about the platforms you are targeting. For example, if you are designing an application that runs on as many platforms as possible, that may stop you from taking advantage of specific CPU features that aid optimization.

Regardless of the level of optimization that you are looking for, you should benchmark your applications whilst in the testing/implementation phase, so that you have a set of results from an application performing at an acceptable level, with which to compare with when you experience performance problems during production. Benchmarking results should be clearly recorded, including the details of the environment in which the application was run (for example: platform, directives set, any specific memory strategy in place).

Previous Topic Next topic Print topic