LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic Searching Large 1D String Array Painfully Slow.

Solved!
Go to solution
Solution
Accepted by topic author n2new

Attached is a quick example I threw together using a Map.  It's all based on random 5-character strings.  I have a fixed Map containing 500k of them and then an array containing another 50k of them.

 

50k lookups in a 500k Map is taking about 65 millisec with For Loop parallelism *disabled*.  When I allow 4 parallel loops it's down to about 35-40 millisec.

 

Attached is the simple example code, but you'll need LabVIEW 2019 or later for Maps.

 

LabVIEW 2020 SP1 introduced an NI-supplied binary search of a pre-sorted 1D array.

 

In prior versions, we resorted to Variant attributes or coding our own binary search.

 

 

-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 21 of 23
(589 Views)

Works Great thank you!

0 Kudos
Message 22 of 23
(569 Views)

This works and is about the same speed as the Search sorted vim, new in 2020. I opted for the VIM just because it's small and clean. Thank you!

0 Kudos
Message 23 of 23
(568 Views)