LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Add column to large array

Solved!
Go to solution

Gerd,

 

That worked perfectly and it was so much faster.

 

Thank you!

 

Chris

0 Kudos
Message 11 of 16
(2,229 Views)

 

0 Kudos
Message 12 of 16
(2,222 Views)

Hi Humada,

 

it was faster because:

- I switched to auto-indexing, LabView is optimized for that case.

- I do the appending of the timestamp in the loop, hence appending to a small 1d array. You did the insertion on the big whole array, blowing from 56MB to 64MB with a lot of datacopying involved. (Not to forget all those coercion dots, which really can hurt on big arrays...)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 16
(2,218 Views)

Gerd,

 

 

I am new to using Labview, as you could probably guess, and I appreciate your explanation of why your vi was faster.  You mentioned that the coercion dots would also slow down the loop and smercurio_fc mentioned that it was a problem on my vi as well but I do not know what you mean by coercion. Could you explain a little further?

 

Thank you,

 

Chris

0 Kudos
Message 14 of 16
(2,194 Views)

Coercion dots appear whenever there's an implicit conversion of one data type to another, like from an integer to a floating point or vice-versa. LabVIEW is telling you that there's a data type change occurring there that it's doing. This can occur if you wire two different datatypes into a function like Add. If you wire an integer and a double, then the output will be a double since it's the larger datatype. The integer will get coerced into a double so the floating point addition can occur. Whenever this occurs with arrays it's almost always bad since arrays can be large, and hence the operation is expensive in terms of memory and time.

 

There's a chapter in the LabVIEW Help on memory usage. A copy of it can be found here.  About halfway down there's a section titled "How to Generate Data of the Right Type" that shows you the impact of coercion on arrays.

Message 15 of 16
(2,183 Views)

 

Thank you for the explanation and the link.  I will be sure to watch for them from now on.

 

 

0 Kudos
Message 16 of 16
(2,175 Views)