brownx Posted November 22, 2016 Report Posted November 22, 2016 I have a CSV with data like: Name Addr Number Paul 13 235 Sarah 1 15 I need the fastest possible way to get the Addr/Number pair which matches the searched name (exact match, occurs only once). The whole search will be called lots of times from a teststand - this is why I need to have it fast. The simplest is to load the csv into array once than do a loop with string compare (fastest in this case probably being the string subset). Is there any faster way for achieving this without hardcoding the name,addr/number pairs into a switch/case? Quote
brownx Posted November 22, 2016 Author Report Posted November 22, 2016 Just found the lookup tables (variant) - probably I'll go this way if there are no better ideas. Quote
hooovahh Posted November 22, 2016 Report Posted November 22, 2016 The variant attributes is probably the fastest way for any decent sized table. Otherwise you are using the search 1D array. You can run some speed and performance testing to see which is faster for the data you have. I'd recommend you watch some of the 2016 advanced user track videos on Benchmarking and Optimization...but NI's site is a bit broken at the moment and I can't find hardly anything, but this is where the session content is, videos are a bit harder to find. http://forums.ni.com/t5/NIWeek-Session-Content/TS9524-Code-Optimization-and-Benchmarking/ta-p/3321074 1 Quote
hooovahh Posted November 23, 2016 Report Posted November 23, 2016 Okay after some searching I finally found the NI Week 2016 presentation I was talking about. http://forums.ni.com/t5/2016-Advanced-User-Track/TS9524-Code-Optimization-and-Benchmarking/gpm-p/3538653 1 Quote
brownx Posted November 25, 2016 Author Report Posted November 25, 2016 (edited) Made the code using variant just to find out TestStand have problems with passing variants ... At least I did not succeeded to create a Global variable to hold a variant and pass it to the steps (tried container and object reference) - forums are full with this issue, I'll see what I can understand from them. Update1: Pfff - seems it is not working, at least not with my version of TestStand:http://forums.ni.com/t5/NI-TestStand/LabVIEW-Variant-Attributes-get-lost-in-TestStand/td-p/3172358 Update2: Managed to make it work with DVR - probably is even better since the 2-300 line lookup table is not copied in every step. Edited November 25, 2016 by brownx Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.