LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

For loop is taking too muc time to execute

Solved!
Go to solution

@Karan_jasani wrote:

Hi,

Please find attached VI where input array is having default values.

The output is correct but takes around 5 minutes.


2.5 minutes for me.

 

I'm looking forward to see how much Altenbach reduces it.

0 Kudos
Message 11 of 26
(641 Views)

@RavensFan wrote:

@Karan_jasani wrote:

Hi,

Please find attached VI where input array is having default values.

The output is correct but takes around 5 minutes.


2.5 minutes for me.

 

I'm looking forward to see how much Altenbach reduces it.


I'm betting two primitives and an auto-indexed FOR loop.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 12 of 26
(638 Views)

@RavensFan wrote:

2.5 minutes for me.

 

I'm looking forward to see how much Altenbach reduces it.


I got it down to 284.9ms...


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 13 of 26
(637 Views)

@crossrulz wrote:
I got it down to 284.9ms...

 


 

Mine was pretty similar but I have the gut feeling that it can be optimized further. 😉


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

@altenbach wrote:

@crossrulz wrote:
I got it down to 284.9ms...

 


 

Mine was pretty similar but I have the gut feeling that it can be optimized further. 😉


Yep, I've been playing some more.  Preallocating the array and not reshaping seems to help quite a bit.  My Profile Performance and Memory is showing an average of 103.4ms.  Though, this is starting to look a little messy.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
0 Kudos
Message 15 of 26
(602 Views)
Solution
Accepted by topic author Karan_jasani

Here's my version. I am on an old laptop. Will test on a more powerful machine later.

 

altenbach_0-1600802557225.png

 

It would be curious if pre-allocating the output array would make any difference. The compiler should be smart enough to figure out the final size. 😉

(And yes, we only need to mask the lower trace, of course. Not shown)

 


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

(Edited: network problems on my side, couldn't upload images…)

 

 

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 17 of 26
(600 Views)
Solution
Accepted by topic author Karan_jasani

My approach:

 

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
Download All
0 Kudos
Message 18 of 26
(594 Views)
Solution
Accepted by topic author Karan_jasani

Another version (~33ms)....

 

 

altenbach_0-1600803427017.png

 

Parallelization helps slightly, bringing it down to ~22ms. Probably not worth the extra overhead:

 

altenbach_1-1600803516550.png

 

 


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

Loopless:

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 20 of 26
(578 Views)