08-26-2011 12:05 PM
Hey guys,
Attached I have some code that demonstrates an issue I'm having with the replace array subset function. Please look at Cursor Plot example and compare it with the speedy example.
In Cursor Plot Example, I'm getting the replace array subset function to take as long as .5 ms on my computer to complete. Clearly this is terrible if you need to replace lots of elements on a large array.
My examples require Windows! Lemme know what you guys think!
- Chris
08-26-2011 01:43 PM
The lvlib does not contain what you might think it does. We need the actual VIs.
08-26-2011 02:03 PM
How about this.
08-26-2011 02:46 PM
I can only see the speedy example. Where is the cursor plot example?
08-26-2011 02:57 PM
Sorry, this has all been bad. I had renamed it when I copied it, but then I didn't make the zip file out of that copy.
So you should compare it to "draw connected cursors".
08-26-2011 03:12 PM - edited 08-26-2011 03:14 PM
Remove the inner time measurements and the loop will execute in microseconds. Keep only the line time.
(The act of taking all these time measurements slows you down significantly.)
08-26-2011 03:31 PM
While I don't disagree that the measurements take time, the reason why I'm doing those measurements is because the loop is slow even when they don't exist.
How long it takes to query the performance counter in windows is actually given by the QPF Resolution indicator. As you can see it's 2 orders of magnitude faster than the measurements found in the array (which is a measurement done on either side of the replace array subset vi).
08-26-2011 03:36 PM
08-26-2011 03:37 PM - edited 08-26-2011 03:44 PM
The QPF resolution indicator does not tell you anything, because it (1) executes in paralell to other code and (2) it does not measure the second call that contains the extra "convert to time?" code.
As an experimentalist, delete the inner sequence structure and keep only "replace array subset" it will be several orders of magnitude faster to draw the line.
08-26-2011 03:44 PM
It's only marginally faster without the counter call. I didn't start this investigation by putting those counter calls in the main loop. I tested each portion of code (including with the profiler). It was only after testing everything else that I got to this point.
Do we agree that each array replacement should only take a microseconds at most? Well, without the counter calls it takes me about
0.000537094
To do one iteration. I don't see any weird buffer allocations or anything. I can't see why this is taking so long.