LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Difference between local variable and property node value?

Solved!
Go to solution

Hi,

can someone explain to me what the difference is between a local variable and a property node value? In what cases is one used rather than the other?

Functionally they seem to me to be the same thing; what is the correct use of them?

0 Kudos
Message 1 of 6
(2,940 Views)

According to this LAVAG topic, property node is slower, otherwise they are functionally the same.

Also Value(signaling) property node updates the control event, while local variable does not.

 

This forum topic also talks about it, with link to comparrison in performance.

0 Kudos
Message 2 of 6
(2,939 Views)
Solution
Accepted by topic author sepp974

A property node forces the execution to the UI thread and awaits a screen update(?), whereas a local works on the data of said control. Both are to be used sparingly and carefully. The wire is almost always the better choice.

One benefit or the property is that you can send a control ref to it so you can use some function for many controls.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 3 of 6
(2,911 Views)

@Yamaeda wrote:

A property node forces the execution to the UI thread and awaits a screen update(?)


It actually forces a screen update, which is horribly slow compared to your code.  Last time I did the benchmark, property nodes were 1000s of times slower than local variables due to the thread swap and panel redraw.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 6
(2,835 Views)

@Yamaeda wrote:

A property node forces the execution to the UI thread and awaits a screen update(?), whereas a local works on the data of said control. Both are to be used sparingly and carefully. The wire is almost always the better choice.

One benefit or the property is that you can send a control ref to it so you can use some function for many controls.


The "new" functions "Get Value by Index" and "Set Value by Index" essentially allow similar performance to local variables, but packed in such a way that it can be used in sub-VIs just like property nodes with references. You just need the VI reference and control index of the control you want to use. Gives the "performance" (and no UI Thread need) of locals but with the portability of VI Server calls.

Message 5 of 6
(2,774 Views)

@Intaris wrote:

@Yamaeda wrote:

A property node forces the execution to the UI thread and awaits a screen update(?), whereas a local works on the data of said control. Both are to be used sparingly and carefully. The wire is almost always the better choice.

One benefit or the property is that you can send a control ref to it so you can use some function for many controls.


The "new" functions "Get Value by Index" and "Set Value by Index" essentially allow similar performance to local variables, but packed in such a way that it can be used in sub-VIs just like property nodes with references. You just need the VI reference and control index of the control you want to use. Gives the "performance" (and no UI Thread need) of locals but with the portability of VI Server calls.


Right. I remember i did some tests on it but didn't quite get it to work, i don't know what i did wrong.

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 6
(2,697 Views)