From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing a large 3D-array to a sub vi and back causes huge loss of performance

I am passing a large 3D-Array of type I16 to a sub-vi node of same type, and back to the main VI. For test purposes I have removed all processing in between. Still, the sub-vi call requires many ms to s, depending on array size. I was under the impression that variables are passed to sub-VIs by reference. Is this incorrect? can it be fixed?
Johannes
0 Kudos
Message 1 of 3
(2,421 Views)
Hi,

Is the subVI's front panel open or closed when you try this?

If it's open, the (graphical) updating of the input control and output
indicator might cause the overhead.

Regards,

Wiebe.


"JohannesK" wrote in message
news:5065000000080000003A670000-1031838699000@exchange.ni.com...
> I am passing a large 3D-Array of type I16 to a sub-vi node of same
> type, and back to the main VI. For test purposes I have removed all
> processing in between. Still, the sub-vi call requires many ms to s,
> depending on array size. I was under the impression that variables are
> passed to sub-VIs by reference. Is this incorrect? can it be fixed?
> Johannes
0 Kudos
Message 2 of 3
(2,421 Views)
Hi Johannes,

(There may be exceptions but) No, variables are not passed and returned by reference.

"A fix" may be possible by restructuring your app such that the large 3d array never gets moved around. This can be done by using what I call an action engine. It uses a variation of the LV2 global to store the large array ONE TIME in a shift register. After that, all other operations are performed "in-place".

This technique has allowed me to process very large data sets "on-the-fly".

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