08-20-2013 03:01 PM - edited 08-20-2013 03:01 PM
Was just curious if there was a more efficient way to get the same functionality, maybe something without the reshaping of an array on every loop iteration.
08-20-2013 03:11 PM - edited 08-20-2013 03:13 PM
I have no idea if it's more efficient and I didn't even open your code in LV, but you could try something like this:
This might be more efficient with something like variant attributes.
08-20-2013 03:25 PM
@tst wrote:
This might be more efficient with something like variant attributes.
This is what I wanted to use, however this is a bit of a dumbed down example. I will actually be using two classes that have an "equals" VI I wrote. So, I don't know to tag them uniquely, because I can't just use a numerical value.
08-20-2013 03:27 PM
Try this one on for size...
08-20-2013 03:30 PM - edited 08-20-2013 03:34 PM
Don, that's awesome, but unfortunately if you read my comment above, won't work for my exact situation. That will definitely be added to my "toolbox" however.
Edit: Just dug into it and it doesn't preinitialize anything...this is going on RT so it may not be as efficient as I'd like.
08-20-2013 03:40 PM
Ack! I missed a couple of posts while I was replying and testing the code.
Yeah I agree it will not quite work... hmm
08-20-2013 03:45 PM
Hey Greg,
I had a quick look at your VI. While I didn't do any benchmarking, I think this implementation could be a little better.
Rather than searching and working on the entire (remaining) array, it starts by sorting the array, which I believe is an in-place function. Then it splits out the components in sequence. The intermediate working arrays should be smaller.
If you like the approach, this could be further optimized using the new conditional array build functions.
08-20-2013 03:49 PM
Just read your comment while posting this one -- not sure this would work if you can't pre-sort. 😞
08-20-2013 04:01 PM - edited 08-20-2013 04:03 PM
I think this is sort of where Tst was heading. Not completely sure. But instead of reshaping the array to make it smaller, set the N on the FOR loop so it only iterates over the first N samples. It took about a third of the time for me.
08-20-2013 04:20 PM - edited 08-20-2013 04:30 PM
In 2013 this postage stamp should be rather effecient as all array data changeing operations are eliminated except the conditional tunnel (that was fixed in 2013 right?)
I'm not really set up on a benchmark ready system-- but you are welcome to try