LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

subroutine execution speed

The whole and single purpose of an inline function is to make the code execute as fast as possible without the need for actually calling a function, which is bound to take time.

With the scripting tools over at lavag.org it should be possible to make a preprocessor that does this in labview, and it shouldn't be that big a deal since it is a simple cut'n paste operation.

0 Kudos
Message 11 of 14
(654 Views)
Chris,

That is indeed an interesting point which aptly answers a question I have previously (elsewhere) asked: Why aren't the NI analysis VIs all set to subroutine.  Of course I only has speed in mind.......

Ben,  The idea would be to have an option on the "execution" tab of the VI properties so that one could explicitly set the sub-vi to be "in-lined".  Of course "in-lining" a LV2 global will basically destroy the functionality, but if it's an option, then it's not neccessary.

Another question would be if an "inlined" vi could call non-inlined VIs.  I reckon so, but feel free to correct me.

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 12 of 14
(643 Views)

hi there,

if you would inline sub-VIs the code would inherit the priority of the calling VI. So the execution speed may be optimized, but only with the (maybe lower) execution priority of the calling VI whilst "real" sub-VIs keep their priority level. In RT apps (where you most probably would use this feature) this could lead to strange results.

 

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 13 of 14
(631 Views)

I agree that an inline code functionality would not be a good choice for many cases, it may not have any effect at all, and could make things slow down in many cases as well as add other problems. But, in general when doing FPU extensive things, inline functionality is considered a MUST in other languages. My example earlier:

A(b,c) = b^2 + c^2

 

which is called as:

C = A(b,c)

 

When you look at this simple code, it makes no sense at all to add function call overhead to this. It is not neccesary from a compiler point of view or from readability point of view. For this simple code the overhead in labview would be some 50 ms per 100000 cals ( maybe 15 ms for subroutine flag on) while the floating point operations themselves only take 1-2 ms per 100000 calls. All this overhad will vanish when adding inline functionality while maintaining the readability and maintainability.

0 Kudos
Message 14 of 14
(614 Views)