LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

InitializeArray creats additional buffers in following operations

Hi,
Just met something strange.  When I use InitializeArray component to create a "Single" array, and performs operations to the array, each time the array data will be copied in each following component.  Please look at the attached disgram.
In the lower portion, a Single array is created, then the array is added 1 (Double, so array is coerced to Double), them multiplied by 16, multiplied aging by 16.  However, each time it is added and multiplied, a new buffer is created (see the black dot), and the array data is copied (I can see this in Performance and Memory Profiling). What's the reason for that?
In comparision, if this array is created by For loop, a buffer will only appear at the first "Add" operation, indication a type cast from Single to Double.  This is the expected and reasonable way.
Does anyone know whay there is such a difference?  Shouldn't these two arrays beheave the same?
0 Kudos
Message 1 of 4
(2,561 Views)

Even it is the same if you use constant array.

Check this link for more details

http://digital.ni.com/public.nsf/allkb/DA3F851F8581CE2186256C1C00764C7F

0 Kudos
Message 2 of 4
(2,548 Views)
What is your LabVIEW version?
 
Since everything on your diagram is folded into a constant at compile time anyway, buffer allocations probably don't mean much. Why do you even have all these constant operations that never produce a different result at the output tunnel. Can you explain? You could just run it once and the replace the output tunnel with a diagram constant and delete all that code.
 
In newer LabVIEW version, you could use the "in place" structure (See image). You can also simply change one of the diagram constants to a control to disable folding.
 


Message Edited by altenbach on 03-31-2008 01:21 PM
Message 3 of 4
(2,532 Views)

Hi altenbach,

Yes, the code does not do anything useful, because I am only creating it to illustrate the problem.  Just don't want to distract people with the details in the real design.

Thanks Vsh for telling the answer!

0 Kudos
Message 4 of 4
(2,517 Views)