LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it slower to use subvi's instead of just the code all in one file?

Solved!
Go to solution

@altenbach wrote:

@Jay14159265 wrote:
Why not try it and see for yourself? Make a loop with a bunch of code in it, time that. Then select all the code in the loop, click 'create sub vi from selected code' then time it again. 

Creating a valid benchmarking harness is full of landmines. There is a very high change that the results are meaningless. 😄 


Ok, of course you are right but meaningless or not you can have an answer to this question and its only a few clicks away, why not just see 🙃

______________________________________________________________
Have a pleasant day and be sure to learn Python for success and prosperity.
Message 11 of 14
(631 Views)

Thank you all, awesome answers. 

 

Sounds like for my purposes/experience so far, I can go ahead and stop worrying about it 😁

 

And yes, definitely a beginner to LabVIEW and embedded systems in general

0 Kudos
Message 12 of 14
(625 Views)

@David99999 wrote:

Thank you all, awesome answers. 

 

Sounds like for my purposes/experience so far, I can go ahead and stop worrying about it 😁


Definitely, unless you have a very complex application with a rather involved architecture, chances are pretty much 100% that worrying about this particular thing is worse than even premature optimization.

 

Get in the habit of making subVIs. Learn where and when to make them. General rule: most people make way to few of them than what would be good for a clean and proper application architecture, especially when they start out programming.

 

Test your application and when you find performance bottlenecks, debug and investigate them. There is a 99.999% chance that they are NOT related to subVI call overhead. So don't spend even 1% of your precious time to chase this phantom, for something that is likely only in 0.001% of the cases a potential problem.

Rolf Kalbermatter
My Blog
Message 13 of 14
(615 Views)

@Jay14159265 wrote:

@altenbach wrote:

@Jay14159265 wrote:
Why not try it and see for yourself? Make a loop with a bunch of code in it, time that. Then select all the code in the loop, click 'create sub vi from selected code' then time it again. 

Creating a valid benchmarking harness is full of landmines. There is a very high change that the results are meaningless. 😄 


Ok, of course you are right but meaningless or not you can have an answer to this question and its only a few clicks away, why not just see 🙃


Everything else being equal, the difference will be in the low single digit percentages and will be completely swamped out by other effects (debugging settings, subVI panel open or closed, change in scheduling, other processes, CPU thermals such as turbo boost, etc etc.) and can go either way. Benchmarking is very hard! (start reading here  🙂 )

 

The difference will be so small that it is irrelevant. The decision should be solely based on code clarity and ease of maintenance. I only optimize code for speed in innermost loops and only if there is a good chance to get at least a factor of two out of it.

 

Message 14 of 14
(580 Views)