LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Speed of execute with sub VI

I have a big program with hundreds of inputs through DIO and Analog inputs cards.
My question is:
Does program, that built with a complex sub VI hierarchy, run as quick as a program that built on one block diagram (one VI, almost without sub VI)?
(I know the important issue of the maintenance and so, but I am asking about the speed of execute only).
0 Kudos
Message 1 of 4
(3,087 Views)
Hi,

i don't know exactly how LabVIEW generate execution code, but in such languages as C it takes number of clocks to call sub-function. You can also make litle test: write sub-vi that add 2 numbers and call it in for loop with 100000 cycles and measure time of execution. After that make same loop without sub and compare the times.

Good luck, Nadav.
0 Kudos
Message 2 of 4
(3,087 Views)
On a Pentium III 400 Mhz running LV 6.1 and Win2K calling a sub-VI seems to take approx. 3 microseconds.

Even if the hierarchy is complex the total number of sub-VI calls might not be high (if e.g. you have 1000 VIs and call them twice every second the sub-VI structure will add just 6 milliseconds to the execution time) ; using subVIs mainly becomes a problem if you need to call the VIs extremely often.
0 Kudos
Message 3 of 4
(3,087 Views)
> On a Pentium III 400 Mhz running LV 6.1 and Win2K calling a sub-VI
> seems to take approx. 3 microseconds.
>
> Even if the hierarchy is complex the total number of sub-VI calls
> might not be high (if e.g. you have 1000 VIs and call them twice every
> second the sub-VI structure will add just 6 milliseconds to the
> execution time) ; using subVIs mainly becomes a problem if you need to
> call the VIs extremely often.

Good explanation, and if you are calling the subVI lots of times, then
you can improve the call speed once the subVI is tested and working by
turning off the debugging options or making it a subroutine.

One other note. If you leave the subVI window open, you will see
controls redrawing and toolbar redrawing. Obviously this slows
things
down. It is great for debugging, but when doing timings, be sure to
close the panel. Also, note that if a subVI is not saved, it will also
run somewhat slower than when saved.

Greg McKaskle
0 Kudos
Message 4 of 4
(3,087 Views)