08-01-2022 10:57 PM
@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 🙃
08-01-2022 11:36 PM
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
08-02-2022 02:45 AM - edited 08-02-2022 02:49 AM
@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.
08-02-2022 09:47 AM
@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.