12-21-2022 03:57 AM
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?
Solved! Go to Solution.
12-21-2022 04:05 AM - edited 12-21-2022 04:08 AM
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.
12-21-2022 05:36 AM
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.
12-29-2022 05:46 AM
@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.
01-03-2023 11:15 AM
@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.
01-04-2023 03:28 AM
@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.