LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI runs slowly until block diagram is opened

Solved!
Go to solution

I have a subVI that scans the computer for any NI hardware that's plugged in, and if found gives me some basic info about it.  This VI is usually called by a main VI, and I was noticing that it was running very slowly.

 

Opening up the subVI's front panel and running from there (instead of being called by a different VI) produces the same effect.  It takes about 1.5-2s to run completely.  However, once I open the block diagram for the subVI, suddenly it only takes a handful of miliseconds to run.  This effect continues even if I close out of the block diagram and even out of the whole subVI, and only goes back to being slow if I completely restart LabVIEW. 

 

So I guess I was wondering why this problem is happening and what I can do to stop it.  I searched pretty heavily on these forums and couldn't find anyone with even a remotely similar issue.

0 Kudos
Message 1 of 3
(1,168 Views)

Who wrote the VI? Can you show us some code?

 

Hard to tell what's going on but maybe the Vi is caching earlier results. Scanning for hardware is typically not instantaneous.

0 Kudos
Message 2 of 3
(1,164 Views)
Solution
Accepted by topic author nichkane

Well, I didn't figure outthe cause of the issue, but I circumvented it (and also just made my code a lot better) by using a DAQmx system property node instead of a more general system hardware property node (since I'm only interested in scanning for DAQmx hardware changes anyways.

 

Looks like updating the code with that change fixed my issue, so I suppose you were correct in that it was somehow caching hardware information from previous runs.  All good now!

Message 3 of 3
(1,105 Views)