LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

append rows - which method is faster

Solved!
Go to solution

 

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
Message 1 of 15
(4,512 Views)

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

Message 2 of 15
(4,474 Views)
Solution
Accepted by topic author 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.

Message 3 of 15
(4,468 Views)

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

 

 

Christian

Message 4 of 15
(4,462 Views)

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
Message 5 of 15
(4,460 Views)

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

Certified-LabVIEW-Developer_rgb.jpg

0 Kudos
Message 6 of 15
(4,444 Views)
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
Message 7 of 15
(4,434 Views)
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
Download All
0 Kudos
Message 8 of 15
(4,403 Views)
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
Message 9 of 15
(4,380 Views)
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
Message 10 of 15
(4,376 Views)