LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

which is effiecient to use property node or local variable?

I am wondering which is the best and efficent one between the local variable and property node for value.
0 Kudos
Message 1 of 5
(3,917 Views)
Direct wiring is always the fastest and most efficient. Property nodes tend to be slowest. I think they also run in the GUI thread, which can have effects on performance of multi-threaded programs.

In addition to local variables consider the functional global or LV2 style global which consists of a subVI with a loop which executes once and contains an unitialized shift register. Because they are subVIs, they can be customized for such behavior as Initialize, Reset, Read, Write, and so on.

Lynn
Message 2 of 5
(3,909 Views)
Local Variables may consume more memory..

So from a memory efficiency point of view, property node is better.

Local variables can be useful in LV, but should be avoided for large data sets, where the biggest penalty is.
That is because everytime you use a local variable, a copy of the variable is made. LabVIEW has to ensure that everything is reading and writing from one master copy, so simultaneous reads and writes do not collide.

To quote LarsRoe: "local variables are more than a performance problem; they do not follow data flow. This makes it a real problem when debugging because the execution order is more complicated and less deterministic."

Locals are okay for numeric or small string (when used in moderation), or a case where it is for a boolean which stops multiple loops . The abuse gets costly.

Basically, local Variables are ok for simple use.

Hope this sheds a bit of light on the matter.

-JLV-

🙂
Message 3 of 5
(3,891 Views)
thanks
0 Kudos
Message 4 of 5
(3,889 Views)
Hi

Pl. don't use local variables at all and use at times when needed only, use property nodes when you have to use the specific property value because when the programs become bigger it will be difficult for the program to catch up with the processing speed of the processor or labview may not react the way you wanted

Use Wires to connect and transfer data as in a best possible manner like from left to right connection and connected through the top or bottom and make the flow chart diagram drawn like a circuit diagram drawn carefully to minimise the space its being written from left to right or from top to bottom

So happy programming and all the best
regards
mathews.j@consultant.com
0 Kudos
Message 5 of 5
(3,868 Views)