LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

why is summing of arrays faster with IMAQ

Can anyone explain the following?
I have to sum large arrays of doubles many times. It now appeared to be faster to convert the arrays to IMAQ images, use the sum-operator for IMAQ, and the convert the result back to a regular array.
Is IMAQ just programmed more efficiently, or has it something to do with the fact that arrays are polymorphic?
Thanks.
PS : any tips to speed up execution of algebraic operations are very welcome.
Certified LabVIEW Developer (CLD)
0 Kudos
Message 1 of 2
(2,499 Views)
> Can anyone explain the following?
> I have to sum large arrays of doubles many times. It now appeared to
> be faster to convert the arrays to IMAQ images, use the sum-operator
> for IMAQ, and the convert the result back to a regular array.
> Is IMAQ just programmed more efficiently, or has it something to do
> with the fact that arrays are polymorphic?
> Thanks.
> PS : any tips to speed up execution of algebraic operations are very
> welcome.
>

You don't mention what your diagram looked like or what the timing
comparisons were. Since you are comparing to IMAQ, I'll assume a 2D array.

The simplest diagram is to wire the 2D array to the Add Array Elements
node located in the Arithmetic palette. Doing 1000x1000 int32s, or 4M
of data takes between 30 and 1
10 ms on my sort of dated computer. Using
nested loops and shift register takes 200ms with debugging code left in.

I'm assuming that this is faster than what you were seeing. That is
likely caused by how the diagram is written. If you use local variables
to read the array, that is quite inefficient. If locals are used to
store the intermediate result, that is also inefficient.

If that is the reason things are slow, you might want to look for the
performance chapter in the user manual or look at presentations on
zone.ni.com.

If I misunderstood what you were talking about, please post again with
more details.

Greg McKaskle
0 Kudos
Message 2 of 2
(2,499 Views)