We have an application that needs to run (approxomately) at a set frequency. We're having trouble hitting our mark, and we've idenfied the bottleneck as a read from a 2D array, which happens once per cycle. The array size is something like 800000x6, and once each cycle, we extract a row and pass the 6 values along. When we replace the array read with constants, we achieve our 8 msec target.
We've tried a few different methods to access the data, but haven't found any noticable improvement. Here's what we've tried:
After some searching, we thought an "In Place Structure" might be worth trying:
But still no change in execution speed. We also read that global variables are bad for large arrays, so we replaced it with a wire (tested with the second and third methods shown above), but the execution speed actually dropped by a factor of 3. I'm wondering what happens to wires when they pass through loops, case structures and sequences? This is the top level of the application, showing the wired path from "Read Cmnd File" through to "Get Cmnd From Array," which is the sub-VI where the the above screen captures are from.
Is there something else we should be doing here? Maybe some higher-level design issue that we've overlooked?
Also, when the timed while loop doesn't complete in 8 msec, the execution time jumps to 16 msec. Is this normal? Is there a way to have it run "at 8 msec or as fast as possible?"
Thanks in advance,