LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Suggestions for a faster array search?

Hi all,

I need to search through an array of strings (up to around 50k elements), and select those that match a regular expression. I've attached a toy example llb of what I'm doing now. Does anyone have any suggestions for speeding it up? It's not too bad now, but this function gets called hundreds or thousands of times a day, so even a small increase would be great.

Thanks!
0 Kudos
Message 1 of 9
(4,839 Views)
If you keep your VI password locked, the only suggestion I can make is:
Try Harder!


LabVIEW, C'est LabVIEW

Message 2 of 9
(4,839 Views)
/blush, forgot about the darn thing! Passworded as part of a larger effort in exporting code...

Let me try again, my apologies.
0 Kudos
Message 3 of 9
(4,839 Views)
Underflow,
I suggest to NOT resize the array of strings in the subVI. Disable auto-indexing in the while loop and index the array within from the start index and up. You'll prevent LabVIEW from making an unecessary copy of the subarray.
Other than that the most consuming task is the Match Pattern node which can hardly be optimized.


LabVIEW, C'est LabVIEW

0 Kudos
Message 4 of 9
(4,839 Views)
Go with Jean-Pierre's suggestions first.

I would also suggest you attempt to limit the magnitude of your searches.

If you list sorted alphabetically, you could create another smaller array that contains the index where the first letter of the elements of your big array first appear.

If you are looking for "junk" firts check the small array to find out where the "J"s start at. Pass that index to the search function.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 9
(4,839 Views)
Also check the Dictionary look-up challenge results due to be anounced on Feb 3. There should be some great search ideas coming out of that challenge.

Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 9
(4,839 Views)
Thanks!
0 Kudos
Message 7 of 9
(4,839 Views)
Thanks, and I'll make sure to keep my eye out for the results of the coding challenge.
0 Kudos
Message 8 of 9
(4,839 Views)
... and set the VI execution property to not allow debugging code. You'll lose the lightbulb and step-by-step function in the VI abd the code will execute faster. You can re-enable debugging when necessary.


LabVIEW, C'est LabVIEW

0 Kudos
Message 9 of 9
(4,839 Views)