04-23-2013 11:42 PM
Hello,
This is a continuation of http://forums.ni.com/t5/LabVIEW/Shared-clone-reentrancy-and-inlining/m-p/2372022
So, inlining a VI requires allocating memory for every call, making it behave effectively as a preallocated clone. The difference is, an inlined VI will also remove the overhead of making a VI call.
Given this, would it be correct to say that inlining offers everything that preallocated clones can offer, but is even faster? Are there any situations where I'd want a preallocated clone that's NOT inlined? (I can think of one: For debugging, it could be useful to know where an error was generated, but inlining a VI will make the error appear to originate from the calling VI. However, I don't think this is relevant for a release build)
On a slight tangent (for curiosity), does the LabVIEW compiler automatically perform inline expansion for optimization, the same way a C++ compiler might?
04-24-2013 03:32 AM
Well, as said in the other thread, inlining essentially copies the machine code into the calling VI so that the CPU doesn't have to jump, which means generating multiple copies of the instructions, which means a larger executable, etc., which can hurt you if you have multiple copies of the VI, particularly if you don't call them often.
I'm also guessing that LV doesn't automatically inline VIs for EXE for exactly that reason - determining whether it actually is an optimization or not is not something it can usually do.