LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Speed of array

Hello,

i have one problem. I want to simualte a Microprocessor with Labview. And i insert my states in an array. It works very well but if i want to write or read memory and i have 200000 states to insert in the array. Labview need to run the vi about 1 hour. If i delete the array it runs under 1 second. What can i do that i can insert my states in an array so fast if it is without an array?

I have initialize the array and insert my state but it needs the same time.

I hope somebody can help me
0 Kudos
Message 1 of 9
(4,621 Views)

I'm not entirely sure what you are doing, but LV should not have a problem with handling an array with 200,000 elements. The best advice is probably to make sure you don't resize the array. Initialize it once and use a loop with a shift register to replace elements of the array.

If this didn't help you, I suggest you post the relevant piece of code, or at least an image of it (no BMPs, please). Also, add some more details about what you're trying to accomplish.


___________________
Try to take over the world!
0 Kudos
Message 2 of 9
(4,612 Views)
I think we need to see your code.
0 Kudos
Message 3 of 9
(4,612 Views)
Just a pot-shot.

You say you initialize the array and then insert....  Try initializing and then REPLACE into the array.  One function causes the array to grow dynamically (Very slow), the other doesn't.  Guess which is which 😉

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 9
(4,607 Views)
Here is the example.

I use replace but it needs one houre to finish it.
0 Kudos
Message 5 of 9
(4,605 Views)

Hi,

Replace those locals you have there with shift registers and you'll see the performance of your program increasing drastically.

Paulo

0 Kudos
Message 6 of 9
(4,599 Views)

Well I don't know if you can apply this concept to your original program but with the sample program you provided you can built your array in the for loop itself. With the sample program you provided this is the fastest way to build an array. View attached image for details. Hope this can be applied to your original program. If not post more details about your original program.

Nariman
0 Kudos
Message 7 of 9
(4,597 Views)
Hello,

The original Programm is this. Look at case 7 and then  to the loop who is counting from 0 to 07FF.
0 Kudos
Message 8 of 9
(4,587 Views)

Your VI is very big, has hundreds of local variables of your controls and seems to have a lot of code repetition. This is a certain recipe for bugs, headaches and (as you found out), bad performence. It's possible that the only way you will find to really improve performance is to rebuild the entire application.

I suggest you read the LabVIEW style guide. Also, think about taking of NI's courses.

As a stop cap measure, start by right clicking the array's terminal and select Hide Indicator. Then, replace all instances of the array inside the loop with a shift register that will carry your data and use Replace Array Subset instead of build array.

This should give you some improvement, but ultimately, the only thing you can really do is rewrite the app.

 

___________________
Try to take over the world!
0 Kudos
Message 9 of 9
(4,562 Views)