User`s guide
444 VEE User’s Guide
12 Optimizing Agilent VEE Programs Chapter
Basic Techniques for Optimizing Programs
To optimize VEE programs, read the information in this section.
You can use the techniques described here to develop good
programming habits in VEE.
Perform Math on Arrays Whenever Possible
Performing mathematical operations on arrays greatly improves
program performance. For example, suppose a test must find
the square root of measurements being taken. The traditional
way to program this would be to take a measurement and
calculate the square root in a loop. Instead, in VEE, you can
store all the measurements in an array and calculate the square
root of the array in one step.
In Figure 252, the program iterates 1024 times. Each
iteration calculates a square root.
Figure 252 Calculating Square Roots per Measurement
In Figure 253, the program creates an array of 1024
elements and calculates the square root of the array
(yielding an array of square roots). Although the two
programs both yield the same results, the program in Figure
253 executes about 6 times faster than the one in Figure
252. (This example uses a 300 MHz Pavilion PC.)