LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Build Array function is the worst?

Hi Helper,

Each time the while loop iterates, the FOR loop will allocate enough memory to handle what it thinks it will need. To say much more at this point would require I know the internal workings of the LV 6.0.2 compiler. I am sorry that I cannot be of more help.

The opinions I have expressed are based on some simple bench-mark VI's that I wrote. They were written to compare the performance of the different methods.

To convince yourself that you are using the most efficient method I would stongly urge you put together a quick VI that campares the performance under the conditions you expect in your app. The basic structure of the bench-mark programs was implemented using a number of single frame seq structures. An outline
follows;

Get time in seconds
1st For loop with first method executes X times.
Get time in seconds
2nd For loop with the second method executes X times.
Get time in seconds
Figure out how long 1st for loop took, divide by X.
Figure out how long 2nd for loop took, divide by X.

If you do this make sure you are really comparing apples to apples. What goes in each of the "for loops" should be functionally identical to make sure multi-threading does not throw-off the numbers.

Just trying to help,

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 11 of 13
(761 Views)
Helper wrote:
>
> Now it makes sense! But I have a for loop inside a while loop, is that
> a problem or that should not make a difference?

For the final answer, see
http://zone.ni.com/devzone/conceptd.nsf/2d17d611efb58b22862567a9006ffe76/732cec772aa4fbe586256a37005541d3

"LabVIEW Performance and Memory Management - Tutorial - Development
Library - National Instruments".

Mark
0 Kudos
Message 12 of 13
(761 Views)
Hi Mark and Helper,

I wonder if that article has been updated since LV 6i. The statement that auto-indexing on the edge of a FOR loop is the same as in a WHILE loop is what makes me ask this.

In LV 6i the auto-indexing (of an output tunnel) in the FOR loop performed almost identicaly to the init_array_to_shft_register/replace_array scheme. When I noticed this, I told my boss that it looks like NI implemented what was being taught in the LV advanced course.

What do you think?

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 13
(761 Views)