From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

for loop timing

I have a for loop in a sub-VI whose execution time increases with each call of the sub-VI.  Has anyone experienced this sort of behavior?  The loop's primary function is to collect data from an XML file.  I found that many of the built in XML functions execute rather slowly, and have minimized their use, but the loop still takes longer and longer to execute.

 

Thanks in advance for any help you may be able to provide,

David

0 Kudos
Message 1 of 7
(2,622 Views)

Without seeing any code, I would have to say the data file is growing bigger with each passing moment and therefore takes longer to read.  Smiley Wink

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 7
(2,620 Views)

Sorry, because of the type of work I do, I'm hesitant to provide segments of code.  The Files are fixed size, I'm opening them as read only, and have the code designed so that they are opened only on the first execution of the sub-VI.

 

So thanks for the suggestion, but I've already got that one covered.

 

David

0 Kudos
Message 3 of 7
(2,615 Views)

Sounds like an uninitialized shift register that grows with each call thus processing more and more data.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 7
(2,584 Views)

Again, thanks for the suggestion, but I've removed all the shift registers from the for loop.  The loop has one indexing tunnel and 6 other tunnels (including an error cluster) coming in, and three indexing tunnels going out.  It also contains a while loop and a few case structures inside the loop.

 

For the information of anyone else that views this thread, I'm a seasoned LabVIEW developer.  Although I let it expire I once held a CLAD certification, and just missed the required score for CLD certification.  I believe I've examined all the obvious stuff regarding timing of this loop, but can't see what's causing the gradual increase in execution time of subsequent calls.  I've even gone so far as to place diagram disable structures around various parts of the code within the loop in an attempt to isolate the cause to a certain part.  It seems that all the parts of the code within the loop are contributing to the problem.  I have also opened a service request ticket with NI regarding this issue.

 

Thanks again for the suggestion,

David

0 Kudos
Message 5 of 7
(2,549 Views)

Ok folks, I have it figured out.  It turns out that there are a LOT of references opened when you do wtuff with XML files.  If you neglect to close them ALL, it may cause the timing of yout code to slowly increase.

 

I went through my code, and systematically close every reference that I'm done using, and VIOLA! the loop is consistentaly at 131 ± milliseconds.

 

Thanks for the suggestions, and let's mark this one closed.

 

David

Message 6 of 7
(2,540 Views)

 OOPS sorry about all the typos.  In my excitement of having solved this I forgot to run the spell checker. :-0

 

David

0 Kudos
Message 7 of 7
(2,533 Views)