LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Search variant attribute instead of 1D-array-search


I 've red an Article about using Variant Data in LabView (http://www.ni.com/white-paper/4998/en/)

"Do not use variant attributes in place of a cluster, or to store large numbers of values. Variant attributes provide a quick and dirty associative array functionality, but attribute lookups are O(n) operations (time required for the operation increases in proportion to the array size). Using a variant this way also does not match the usual LabVIEW conventions."

Darren Nattinger (CLA) wrote in an other article that the method of accessing the data by using Variants is much faster than to search in an Array: http://forums.ni.com/t5/LabVIEW/Darren-s-Weekly-Nugget-10-09-2006/td-p/425269

As I understand it right, this is a contradiction. Who is right? Is there a literature source on this topic?
I would be grateful, if someone could help me.

kind regards,
Jonathan Keller
0 Kudos
Message 1 of 2
(2,956 Views)

Your first quoted article is wrong. Variant attributes are stored in a red black tree which performs as O(logN) for search, insert, delete, etc. and is thus very efficient.

 

See also my suggestion about associative arrays.

 

In my fitting program, I use variant attributes as a caching mechanism for parallelization. Here we have several thousand attributes, each attribute being a string of several hundred characters. It performs fantastically. I wrote some caching demos showing that the performance goes with logN. (after some code improvements, the cached performace is now near 30k spectra/second and each spectrum involves multiple cache searches).

 

0 Kudos
Message 2 of 2
(2,946 Views)