08-26-2011 04:11 AM
Hi there,
I am working on a labview program for real-time data processing. So, code running efficiency will be critical. I am wondering how about the calling cost of the DLLs. Similarly, how about the calling cost of sub-programs.
To implement the same function, will the call of a sub-VI be faster than the call of a DLL?
If I can expand all the sub-VIs into the main program and remove all the callings, will that be much faster?
Any one can give me any clue or guideline?
Thanks.
Solved! Go to Solution.
08-26-2011 04:31 AM
crxx wrote:[...]I am working on a labview program for real-time data processing. [...]
What is the OS you are using?
Since you ask in general, i answer in general:
This question cannot be ansered. It is a case-by-case-thing and has to be benchmarked individually.
Most effect will be memory management: Who is allocating how much memory? When is this done?
Esp. memory allocation messes up determinism, so a DLL might perform worse than pure LV code (given an LV RT OS). But it might be better for certain encapsulated algorithms..... no one can tell in general.
The most important question is possibly this:
How often is the code (DLL vs. Sub-VI) called and how short is its execution time? If the relation code execution:call overhead is very low (=> 1:1), it is best to "resolve" the subcode. SubVI Inling is a valid way in pure LV (as of 2010).
If the code is called seldom, the whole discussion is somehow obsolete since the call overhead will be neglectible, even if it would be quite high.....
And no, C is not faster as LV by definition. It also depends on the task and the way you implement it..... 😉
hope this helps,
Norbert
08-28-2011 08:28 PM
Thanks Nortert for your quick response.
I do need call the sub-code very often. Just want to figure out a way to let the diagram look simple. I tried inline SubVI.
Your answer confirmed my guess that any other calling, either SubVI or DLL, will give us call overhead.