LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop is taking too muc time to execute

Solved!
Go to solution
Highlighted

@GerdW wrote:

Loopless:

 


Have you counted the allocation dots? Probably significantly more memory overhead with all these seperate intermediary arrays (2D, 1D). Not sure if a few ms are worth it...


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 21 of 26
(449 Views)
Highlighted

Hi Christian,

 

that's the usual trade-off: time vs. memory consumption…

(I wondered it's even faster when allocating more array wires in between.)

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 22 of 26
(442 Views)
Highlighted
Solution
Accepted by Karan_jasani

Curiously, interlacing is faster than my typecasting (~19ms , or about 8ms when the loop is parallelized).

 

altenbach_0-1600804973434.png

 

 

altenbach_0-1600805353831.png

 

 

I am sure we can squeeze a little bit more out of it, but going from 5 minutes to 10ms is quite good, IMHO ;))

 

The first estimate of getting 1000x improvement was low. We got about 30000x! 😮

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 23 of 26
(434 Views)
Highlighted
Solution
Accepted by Karan_jasani

Hi,

 

not getting so much faster, but there also is a DecimateArray for each InterleaveArray:

Atleast it fits the postage stamp… 😄

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Message 24 of 26
(426 Views)
Highlighted
Solution
Accepted by Karan_jasani

@crossrulz wrote:

Preallocating the array and not reshaping seems to help quite a bit. 

It surprised me that the concatenating tunnel is about 20x slower, even though the compiler could probably figure exactly what to do based on the build array with two scalars inside the loop.

 

Here's what I probably would do in the end:

 

altenbach_0-1600806388224.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
0 Kudos
Message 25 of 26
(419 Views)
Highlighted
Solution
Accepted by Karan_jasani

@GerdW wrote:

A tleast it fits the postage stamp… 😄


No kidding 😄

 

altenbach_0-1600807442449.png

 


LabVIEW Champion. It all comes together in GCentral GCentral
What does "Engineering Redefined" mean??
Message 26 of 26
(407 Views)