This site uses cookies to bring you the best experience. Find out more
Skip to main content

blog

LabVIEW Map Performance Assessment

Introduction

We have recently had some requirements where Maps have been utilised and we were intrigued by the potential to improve their perofrmance. What we found was that the potential is MASSIVE depending on the setup and functions that you use.

We needed to run a loop with a Map passed to a sub VI inside the loop. The Map had a large number of entries (>10,000) and optimising the management of the data for speed was important, keeping in mind the need for ease of debugging.

The thought process was that any loading of the map onto the front panel would be detrimental to the performance, so we started off with a sub VI, see below, with minimal functionality (just changing the values of keys already present) to really test this out.

To enable the assessment of performance a Map of size N was created (LabVIEW code below) using a For Loop where the Map value is equal to i and the key is a cluster of “num” and “bool” where: 

  • num = N - i - 1 
  • bool = 1 if num % 2 = 0, 0 if num % 2 != 0 

Testing

To enable the sub VI to be put through a series of tests, we created a test harness that runs the sub VI in a loop for a certain number of iterations to determine execution performance. 

This allowed us to switch up how the sub VI executed the Map function and test it consistently. The configurations of the sub VI that we tested are described below.

  • Standard: as above 
  • Re-Entrant: as standard with the VI set to re-entrant execution 
  • DVR: Create a Data Value Reference of the Map and pass this to the subVI: 

  • In Place: Insert into Map in-place 

  • Auto-Error Handling Off: self-explanatory 
  • Allow Debugging Off: self-explanatory 
  • Inline: self-explanatory 
  • Combination: DVR + Inline 

Using a Map size of 1,000 the results are shown in the following table (iterations were adjusted to ensure each test ran for approximately 1s):

Test 

Iterations 

Time (s) 

Iterations per ms 

Standard 

3,000 

1.119 

2.7 

Re-Entrant 

10,000,000 

1.247 

8,000 

DVR 

5,000,000 

0.929 

5,400 

In-Place 

3,000 

1.239 

2.4 

Auto Error Handling Off 

3,000 

1.244 

2.4 

Allow Debugging Off 

3,000 

1.245 

2.4 

Inline 

20,000,000 

1.177 

17,000 

Combination 

10,000,000 

1.362 

7,300 

 

Using a map size of 1,000,000 the results are shown in the following table (iterations were adjusted to ensure each test ran for approximately 1s): 

Test 

Iterations 

Time (s) 

Iterations per ms 

Standard 

1.069 

0.003 

Re-Entrant 

10,000,000 

1.587 

6,300 

DVR 

5,000,000 

1.096 

4,500 

In-Place 

1.164 

0.003 

Auto Error Handling Off 

1.063 

0.003 

Allow Debugging Off 

1.072 

0.003 

Inline 

10,000,000 

1.07 

9,300 

Combination 

10,000,000 

1.664 

6,000 

Conclusion

The results, as we mentioned, showed significant improvements with inlining the sub VI giving the biggest change, increasing operation speed by a huge 6000 times with a small Map, and around 3 million times with a large Map! One drawback that needs to be considered with this approach though is that debugging is made more difficult.

Coming in second place with a still impressive scale of improvement was making the VI re-entrant. This increased speed by around 3000 times with a small Map, and around 2 million times with a large Map! This approach also takes some of drawback away that you have with inlining, it is a little easier to debug. 

If debugging is top of your priority list then passing the Map as a DVR is the one for you, we still saw significant improvement in perofrmance, but not drawback in your debugging. This apparoch increases operation speed by around 2000 times with a small Map, and around 1.5 million times with a large Map. 

In general, WOW! Lots of big numbers show the benefits of considering how you implement data management with Maps in LabVIEW and in summary

  • The overhead for passing a Map to a subVI increases with the size of the Map.
  • Serious performance improvements are possible with inlining, sub VI re-entrantrancy, and using a DVR. 

Happy mapping people!

Back to Blog listings

ARGENTA IS A LEADING PROVIDER OF PRODUCT RELIABILITY AND PROCESS IMPROVEMENT SOLUTIONS.

Call 0121 514 2290 to discuss your requirements