10-09-2006 02:09 PM
10-09-2006 02:22 PM
Make sure you're fair in benchmarking the full code. Currently the entire first loop is "folded" into a constant in 8.20. If the names are allowed to change at runtime, this would need to be recalculated. How expensive is that actually? Sorry, I rarely use variants... 😉
@Darren wrote:
Hopefully this example VI clears up some of the confusion.
10-09-2006 02:32 PM
That example wasn't intended to be benchmarked...I just wanted to demonstrate how you would populate, then later read, the variant attributes.
-D
10-09-2006 02:59 PM - edited 10-09-2006 02:59 PM
Message Edited by Underflow on 10-09-2006 03:00 PM
08-19-2009 09:38 AM
"Of course worrying about performance for things like that makes only sense for huge data structures. ".
On a PC yes...On a PAC no. On PACs you run into a performance issue pretty quick as the standard search is in the order of 20 times slower than on a PC....
With the variant attribute-trick the PAC can even outperform a PC running the standard search.
03-04-2010 09:13 AM
Darren,
would you be able to post the code for the approaches? I want to get a better handle on them.
Yik
07-20-2012 07:23 AM
Actually I was building a "generic" functional variable than hold arbitrary variables. I started using a simple array of strings but then I learned about this variant trick described here. However this performes much slower in my code than the 1D array of strings (I use the "substitute variable" convention to define variables). In my small test vi it turnes out that the array can be written 5 times faster than the variant using the set variant attribute vi.
For the array I am first searching the array for the name of the variable to then replace the value string. So I am wondering if this variant attributes only perform better at low number of attributes?
Best regards,
Martin
07-20-2012 08:36 AM
What version of LabVIEW are you using? There appears to have been a significant boost in Variant Attribute performance between LV 8.6 and 2009.
http://lavag.org/topic/12223-variant-attribute-performance/
07-20-2012 09:52 AM
Thanks for the response! I am using version 10.0f (32 bit).
Best regards,
Martin
07-20-2012 10:22 AM
Something doesn't sound right, I would expect that the variants would perform better (for searches) as the array size grows.
If your previous array implementation has a small number of elements and the elements are sorted, that might explain the good performance.
Most discussions on the forums that involve the Variant Attribute technique suggest that the variants will always be faster for moderate to large arrays.