LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

What is difference between local variable and property node ?

One thing people haven't mentioned yet that can be very important in terms of performance when choosing between locals and property nodes is that property nodes (implicit or by reference) cause a syncronous update of the control on the front panel whenever you update the value from them. That means LabVIEW has to stop whatever it's doing, jump to that front panel and update the control. If you do this a thousand times in a loop, you're looking at at least 1000 thread swaps and 1000 redraws. Nevermind that the human eye can't possibly see each of the 1000 updates, that is a huge burden on your system resources.

If you update a value using a local variable, LabVIEW may make a copy, but it can still be smart about when to update that control on the front panel. LabVIEW's default behavior is to store all front panel update requests in a queue and service all of them at once about 60 times a second or so. This provides (or is intended to provide) minimal thread swaps for maximum visual acuity.
Jarrod S.
National Instruments
Message 11 of 29
(8,160 Views)


Jarrod S. a écrit:
One thing people haven't mentioned yet that can be very important in terms of performance when choosing between locals and property nodes is that property nodes (implicit or by reference) cause a syncronous update of the control on the front panel whenever you update the value from them. That means LabVIEW has to stop whatever it's doing, jump to that front panel and update the control. If you do this a thousand times in a loop, you're looking at at least 1000 thread swaps and 1000 redraws. Nevermind that the human eye can't possibly see each of the 1000 updates, that is a huge burden on your system resources.

If you update a value using a local variable, LabVIEW may make a copy, but it can still be smart about when to update that control on the front panel. LabVIEW's default behavior is to store all front panel update requests in a queue and service all of them at once about 60 times a second or so. This provides (or is intended to provide) minimal thread swaps for maximum visual acuity.


This is illustrated by these experimental results : relative execution time for the replacement of 100 000 array elements :

wires                    1
locals                   1607
L2 type globals   2257
Property nodes   15000

Chilly Charly    (aka CC)
Message 12 of 29
(8,145 Views)

CC,

Could you please post the VI's used to generate these numbers?

Thank you,

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 13 of 29
(8,138 Views)
If anyone wants direct proof of how expensive redraw operations are (in LabVIEW or with anything), turn on the Windows Task Manager (Ctrl-Shift-Escape) and click on the Performance tab. Then take any open window, LabVIEW-based or not, and start dragging it around really quickly. Watch your CPU rise... 🙂
Jarrod S.
National Instruments
Message 14 of 29
(8,139 Views)


- you should always seperate naming for the GUI from the naming on the block diagram. for the GUI use the "caption", for the diagram the "label". the locals name is the controls label.

I'm curious -- I very rarely display the GUI caption, preferring to display either the label or nothing at all.  Since you advise always keeping the names separate, you must have a very different approach than me.  What's the thought process behind your rule-of thumb?  It's only on relatively rare occasions that I find need for the caption, usually for generic multi-use indicators whose present contents are id'ed by the run-time-writeable caption text. 

During development, I *like* having the same name on both front panel and block diagram, and having both update in sync if I change one.  I developed my rule of thumb when I was still pretty green with LV after a few frustrating debug adventures where captions and labels got criss-crossed and out of sync.  The code did some calcs and wrote to an indicator labeled "param 3".  On the GUI, that indicator showed only its caption, "param 1".  A *different* indicator had a visible caption "param 3" but was labeled something else on the block diagram.    What a mess!

-Kevin P.

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 15 of 29
(8,128 Views)

Kevin asked

" What's the thought process behind your rule-of thumb?"

I believe that comes from the VI Checklist!

"

The name of a control or indicator should describe its function. If the control is visible to the user, use captions to display a long description and add a short label to prevent using valuable space on the block diagram.

"

See here

http://zone.ni.com/reference/en-XX/help/371361A-01/lvdevconcepts/checklist/

Ben

Message Edited by Ben on 09-21-2006 02:42 PM

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 16 of 29
(8,127 Views)
Guess I'm spoiled -- most of my stuff is used by myself or other techno types that don't miss the extra verbage.  I definitely see now why a nice long descriptive caption can be better than a shorter label, and will try to follow the suggestion more often when I find myself with extra screen real estate.  That doesn't seem to happen very often.  The people I deal with generally seem to want to have all possible display information visible all the time.  Pop-ups aren't highly regarded -- "I don't want to miss seeing X because Y was in the way..."
 
Curious again now.  Another reason I like the shortish labels is for lining up various numeric controls / indicators.  If I've got 5 different numerics that only need to display up to, say, 7 characters, I can easily line them up next to each other left to right provided the labels are also about 7 characters each.  If I went with, say, 25-char descriptive captions, it'd be hard to lay them out without getting much uglier.  Well, uglier to my eye anyway...
 
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 17 of 29
(8,118 Views)
it's also recommended for localization purposes....

You can change the caption programatically, but the label is fixed.

If you want to switch languages, you have to work with captions (or strings, but this is messy).

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 18 of 29
(8,114 Views)


@jarrod S. wrote:
One thing people haven't mentioned yet that can be very important in terms of performance when choosing between locals and property nodes is that property nodes (implicit or by reference) cause a syncronous update of the control on the front panel whenever you update the value from them. That means LabVIEW has to stop whatever it's doing, jump to that front panel and update the control. If you do this a thousand times in a loop, you're looking at at least 1000 thread swaps and 1000 redraws. Nevermind that the human eye can't possibly see each of the 1000 updates, that is a huge burden on your system resources.


Wow...  This one I did not know..  😮

Interesting..  😮

Glad this forum exists!  🙂

Message 19 of 29
(8,102 Views)

It looks like we all just compiled a thesis on the subjectSmiley Very Happy


Glad this forum exists! 


 

Exactly! Smiley Wink

Message 20 of 29
(8,088 Views)