LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What can Labview compiler optimization do?

If I use a (numeric) function that can work on clusters, too (and thereby applying the function on every element of the cluster), will Labview apply the function to all elements in the cluster or onyl those that I actually use after the function.

 

See the screenshot below (this is something I came across recently, but this bugged me a few times before that).

The joystick function returns a cluster containing the values for 8 axis (shown at the top). Then I need to do some calculations (in this example it's to get microsecond values suiteable for RC-servos). But in the end I only need 4 of the values. Will Labview do the calculations for all 8 axis or can the compiler tell that 4 of them aren't even used and not do the operation for those? I know the wiretype always tells me, it's a cluster of 8 values. But this does not mean Labview could do some optimizations (not that they would make a huge difference in this case).

 

example.png

0 Kudos
Message 1 of 3
(2,622 Views)

I would guess that it does this on all numbers. Most likely it does not do backwards optimization like this at all, but since you have a Convert To I16 number in between it can't really optimize anyhow, since that would require a multilevel optimization that would get very quickly into a very resource intense CPU hog, and since LabVIEW does analyze the diagram continously after each edit operation this could get a real issue.

 

Same about unused terminals. While LabVIEW actually does optimize such uses on built-in nodes sometimes (for instance not creating an output array if it is not connected to anything) it won't do such optimizations on subVIs.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
0 Kudos
Message 2 of 3
(2,582 Views)

Hi,

 

if you only want 4 of 8 cluster values to be used for the calculation you can unbundle the needed values, bundle a smaller cluster and make the calcuation only for the needed values in the smaller cluster.

See the screenshot attached: I took 2 of 4 values for the calculation.

 

Best regards

Suse

______________________________
Certified LabVIEW Developer (CLD)
0 Kudos
Message 3 of 3
(2,564 Views)