Visual Basic Concepts

Optimizing for Speed

Speed is often a major determining factor in a user’s overall impression of and satisfaction with an application. Unfortunately, many of the things that influence the speed of an application are beyond your control as a programmer: the speed of the processor, the lack of adequate memory, or the speed of data connections. For this reason, it’s often necessary to optimize your application so that it will run faster (or at least appear to run faster).

Optimizations for speed can be divided into three general categories: real speed (the actual time spent performing calculations and executing code), display speed (the time spent displaying graphics or painting the screen), and perceived speed (how fast your application appears to run). The types of optimizations that you will actually use depend on the type and purpose of the application — not all optimizations are appropriate or beneficial in all cases.

As with any type of optimization, you need to weigh the potential benefit against the cost. It doesn’t make much sense to spend hours optimizing a procedure that is rarely called. Determine the areas where speed improvements will affect (and be noticed by) the most users, such as the initial load time for the application.

To learn more about speed optimizations, see the following topics: