LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Darren's Weekly Nugget 10/09/2006

Long shot: are you using a Feedback Node to hold the variant? There is an annoying bug in LV < LV 10 SP1 that really slows down Set.
0 Kudos
Message 21 of 25
(2,396 Views)

Thanks for the response! Actually I am using a local variable and shift registers. This I use for both versions. I attached the two files and all the necessary sub-VIs.

It is very likely that many of the routines I use are very ineffiecient! However, these are the same for the two verions with a string array and variant attributes. So they might be responsible for the overal lack of performance but not for the difference I guess.

 

The idea is to store the variable using the command "set(variablename,variablevalue)" and retreive it via "get(variablename)". The boolean tells you if the variable value has changed since the last call.

 

Thanks for the support, best regards,

Martin 

0 Kudos
Message 22 of 25
(2,389 Views)

All seems to be right in my world.  A few things I took liberties with:

 

1)  Made "real" functional global variables out of the two VIs.  By this I mean I ditched the local, and deleted the control to let the shift register hold the value.  I added a 'clear' command to empty the Shift register in both cases.

 

2) Missing a couple of VIs: GetVarValue and String to Array, I just guessed what they did (simple search and spreadsheet string to array).

 

3) Benchmarked by clearing then feeding in 5000 set(x#,#) commands (set(x0,0), set(x1,1)... followed by get(x#) to retrieve all of the values.

 

VariantBenchmark.png

 

Times are in seconds, no getting around n vs lg(n)

 

 

Message 23 of 25
(2,368 Views)

FYI, for anyone still following this thread, there is a new data type in LabVIEW 2019 and later called a Map that is a more robust and complete implementation for doing data lookups than the variant attribute technique described in my original nugget post.

 

See the LabVIEW 2019 Upgrade Notes for more information about Maps.

0 Kudos
Message 24 of 25
(1,336 Views)

ok
Welcome Set and Map in LabVIEW 2019

image.png

Certified LabVIEW Architect
Certified TestStand Architect
Message 25 of 25
(1,327 Views)