annulla
Visualizzazione dei risultati per 
Cerca invece 
Intendevi dire: 

append rows - which method is faster

Risolto!
Vai alla soluzione

 

I am working with data from DAQ and I need to append rows. I came with two methods of achieving that and since I work with rather big data blocks I am wondering which approach is more efficient. Thanks for the help.

Message Edited by ceties on 11-10-2009 04:50 AM
LV 2011, Win7
0 Kudos
Messaggio 1 di 15
4.759Visualizzazioni

Hi Ceties,

 

I ran a tes, and it seems method 1 is slightly faster than method 2. For  100000000 iterations, method 1 took 37.4531s, while method 2 took 38.7344s. One of the reasons could be, that you don't need to allocate memory so often (Tools -> Profile ->Show Buffer Allocation).

 

 

 

Best regards,

Stefo

 

Certified-LabVIEW-Developer_rgb.jpg

Messaggio 2 di 15
4.721Visualizzazioni
Soluzione
Accettato da ceties

Both are "SLOW" methods, and quite the same.

If you need to go a lot faster, initialize a big array and then use the "Replace element" function.

 

If you have no speed problems the first is the simplest method.

Messaggio 3 di 15
4.715Visualizzazioni

Initializing an array and then using Replace Array Subset also needs less amount of memory.

 

 

Christian

Messaggio 4 di 15
4.709Visualizzazioni

Correction: your two methods are not the same.

For the reason Stefo wrote the first method is a lot faster than the second.

 

Stefo you did many iterations with a small array.

This is not the case.

If you place a lot bigger array the result will be much different.

0 Kudos
Messaggio 5 di 15
4.707Visualizzazioni

Pnt, that's correct. If you use significantly bigger arrays, you should see difference much more clearer.

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Messaggio 6 di 15
4.691Visualizzazioni
Thank you all. I cannot believe I forgot the initialize-array-first method although I use it quite often but for slightly different purposes. 
LV 2011, Win7
0 Kudos
Messaggio 7 di 15
4.681Visualizzazioni
I might overlooked something but is there some easy way to replace 2D array in 2Darray. Otherwise this method is pretty slow.
Message Edited by ceties on 11-12-2009 07:17 AM
LV 2011, Win7
Scarica tutti
0 Kudos
Messaggio 8 di 15
4.650Visualizzazioni
Your snippet is misleading since that's not what you're actually doing in the VI that you posted. Also, the 3 methods you coded up do not give the same results. I'm a little confused about the question. You said you want to append rows. From a 2D array into another 2D array. I don't really understand that, and that's not what your VI is even doing (any of the methods). They're taking a 2D array and appending columns. If the two arrays have different rows and columns, then what do you do? If you run the VI you posted with two different sized arrays you get 3 different answers. Which one is the correct answer, regardless of speed?
0 Kudos
Messaggio 9 di 15
4.627Visualizzazioni
Sorry I was coding too fast just timing the operation but not checking the results. When I said I want to append rows I meant append one behind the other. If it is not clear from my expression it will be now clear from the code.
LV 2011, Win7
0 Kudos
Messaggio 10 di 15
4.623Visualizzazioni