FieldPoint Family

cancel
Showing results for 
Search instead for 
Did you mean: 

Do unused sub vi's use memory?

Say I have a condition loop and in 'true' there is one sub vi, and in 'false' there is another.  If the condition is true almost all the time, is any run-time memory being wasted on the sub-vi in the false condition?  I don't want to degrade the performance of the 'true' sub vi because the timings that it performs are critical.  If the 'false' sub vi has no impact on the execution, then I am happy.
 
So am I wasting processor cycles by designing the program this way?
0 Kudos
Message 1 of 3
(3,222 Views)

Hi Synap,

As my favourite Professor at University would say, "It all depends!"  If you're using a True/False Case structure, then the both the VIs get loaded in memory -- regardless of which case is True/False.  Obviosuly, only the case which executes runs the respective VI, but the other is still in memory.   

Next, there's a difference between whether you have wired a constant to the Case selector, or the condition is evaluated at run-time.  With a constant wired, which obviously does not change at run-time, the code is compiled to execute only the VI in the True case.  In other words, CPU cycles aren't used to determine this at run-time.  But, as above, both the VIs are still in memory. 

Now, that was pre-LV8.0.  In LV8.0, I believe, if a False constant is wired, that subVI is not even included in the compiled code.  So, it won't get loaded in memory either. 

Hope this gives you some ideas.  If you're using LV8.0, you may want to look into Diagram Disable Structure.

Regards,

-Khalid

0 Kudos
Message 2 of 3
(3,210 Views)

That tells me everything I needed to know.  Thanks!

It's pretty much what I figured, though my interest in 8.0 is definately piqued now.... Smiley Tongue

0 Kudos
Message 3 of 3
(3,209 Views)