Software Efficiency

The following LabVIEW VI was entered into a coding challenge organised by National Instruments.

The goal of the exercise was to create a program which could quickly find the median value of an array of up to 3,000,000 double floating-point numbers. The algorithm used has been heavily optimised to take advantage of LabVIEW's own compiler optimisations.

Media calculation

The VI entered eventually won the competition, finding the Median of a double precision floating point array of 3 million elements (24 Megabytes of memory) in 805ms on a Pentium III machine. The VI was submitted in 2004 and was written in LV 6.1. The built-in LabVIEW function to perform the same operation required over 2 seconds.

By performing all processor-intensive operations on arrays of numbers instead of one-by-one, it was possible to take advantage of compiler options to create largely parallel code. Even choosing data sets which are likely to remain in the L2 Cache of the processor in use can yield impressive performance gains. A thorough understanding of the internal workings of LabVIEW and any bottlenecks present in today's computer architectures is required in order to create such highly optimised code.

Although this is not an every-day application of software development, the knowledge of what can cause a program to execute efficiently is always useful whenever performance is important.