LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

High Loop Time

I am using a Sub VI in my Main VI to break a big array into 4 small arrays, This Sub VI is taking lot of loop time could anyone tell me what is consuming so much time or propose an alternate solution. I am Attaching my Sub VI with this message.
0 Kudos
Message 1 of 4
(2,731 Views)
I dont have any test data to make sure this doesnt break the intended functionality of the sub VI,
but I noticed after you break these into the four seperate sub arrays you immediate rotate the arrays.
I would think as one optimization you should be able to rotate the original array once and change the
indexing for the split arrays to compensate... this would get ride of the four seperate array rotates
possibly producing a speed up...
0 Kudos
Message 2 of 4
(2,717 Views)
How big are your 2D arrays? I created a 1000x1000 for each and your program takes about 400msec on the slow (500Mhz Celeron) pc that I'm on right now. The Select function you have in the for loop isn't necessary.
0 Kudos
Message 3 of 4
(2,717 Views)
Please provide us with some sample data that shows the "slowness". Slow is always relative and has different meaning for different people.

You do quite a few thing that could be more optimized.

Lets look at the four Subarray threads (mentally numbered 1-4, top to bottom).

Thread 1:
Seems OK.

Thread 2:
You slice out a 2D section, transpose it, then only retain one line. This seems inefficient and can be done in one step. It's just a 1xn subset of the original 2D array, right? Wire all inputs to the "Array Subset" node to get your final slice directly.

Thread 3:
Seems OK.

Thread 4:
Same problem as in "2" above. In addition: Not only can you get rid of the "select" in the FOR loop, you can get rid of the FOR loop entirely (see image). Also watch for coercion dots, you are comparing your DBL array with a SGL "5" which thus needs to be coerced to DBL. Right-click on the diagram constant and select "representation..DBL".

Tell us a little more about your application. It seems the two 2D arrays in your cluster possibly grow without bounds if "new data" is constantly appended to the current and position data. This will ultimately cause allocation issues. Does your application only get "slow" over time?
0 Kudos
Message 4 of 4
(2,701 Views)