LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Efficient map, where Keys never change but Values frequently change

Solved!
Go to solution

Hello,

 

I need to pass many independent data points (DBL, voltage readings) around, and they need to be retrievable by name (strings) by different parts of my program. Rather than have a huge cluster with many elements, I was thinking of using a map.

 

My requirements are:

  • The Keys are unchanged for the lifetime of the program
  • The Values change frequently and simultaneously (currently 10 Hz, but might push it to 100 Hz)
  • The data set is quite small (<100 elements)

What's the best way to store my data? https://decibel.ni.com/content/groups/large-labview-application-development/blog/2012/09/04/using-va... describes an efficient look-up table. It seems optimized for fast data retrieval; I'm not sure if it's it suitable for fast, frequent data storage.

 

Would the "best" way be different if I had a large data set (>10 000 elements)?

 

 

Thanks!

Certified LabVIEW Developer
0 Kudos
Message 1 of 2
(2,425 Views)
Solution
Accepted by topic author JKSH
Less than 100 elements with string keys, use the variant attributes and call it a day. For larger data sets I will use a bucket hash scheme. The first step maps the key to one of a fixed number of buckets. Each bucket is a variant, and the attributes are used to resolve collisions. I have implemented other schemes which are faster, but there is a high code complexity cost that is really only worth paying if you are curious or have a very demanding application. Variants are almost plug and play.

Your other option would be an in memory database like SQLite. Good APIs and sufficient speed for all but the most demanding applications.
Message 2 of 2
(2,415 Views)