ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Do comments in block diagram or front panel slow down program execution?

Solved!
Go to solution

Hi Application Engineers,

 

I am wondering if comments in block diagram or front panel slow down program execution, including a piece of image as shown below 

 

edmonton_0-1644463226421.png

 

Thanks,

Gu

0 Kudos
Message 1 of 16
(2,673 Views)

No, it should not, as it is not part of the compiled code, like other languages.

 

Did you observe any difference if you delete the comments?

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
Message 2 of 16
(2,669 Views)

I did a comparison, but not sure if it was a valid comparison. I have a SubVi with comments and image for converting read string to data set. I obtained 750 iterations per second when the subvi has no comments, while 745 iterations per second when the subvi has comments. 

 

 

0 Kudos
Message 3 of 16
(2,663 Views)

Hi edmonton,

 


@edmonton wrote:

 I obtained 750 iterations per second when the subvi has no comments, while 745 iterations per second when the subvi has comments. 


So the difference is less than 1%, quite within your measurement accuracy…

(How did you measure those values? Which actions did you take to make this measurement as accurate as possible?)

 

In the end your VI most probably would run (much) faster once you remove that Wait function and the BytesAtPort property! See this!

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 16
(2,628 Views)
Solution
Accepted by topic author edmonton

@edmonton wrote:

Re: Do comments in block diagram or front panel slow down program execution?


Of course it slows down the start of the first iteration, because it takes time to type the comment 😊. This will pay of later, when you save (lots of) time.

 

I find that often simply changing a VI slows down it's performance. Changing it back doesn't make it faster again. Saving the VI sometimes does. Saving all VIs sometimes does. Restarting LabVIEW usually does.

 

But this applies to highly performant VIs. Serial communication, and waits, will have such an impact on 'performance' (e.g. execution time), I can assure you that comments are totally irrelevant (for performance).

 

Note that this particular comment is quite redundant. CTRL+H shows this when hovering over the VISA config. VI. If you want to have it available, you can then lock this help (middle icon in the help's bottom left corner)... Can't say I never did this, but you'll probably delete it at some point.

Message 5 of 16
(2,608 Views)

Thank you all for your replies.

 

First, the posted partial code and comments are not real for my program, I just copied it from a sample VI, called Simple Serial VI, and took it as an example for describing my question. 

 

edmonton_0-1644512819374.png

 

 

I agree that it may slow down the first iteration as it needs time to exclude comments in execution, once compiled, comments should have no effect on execution. 

 

My thought is that NI might have a clear description somewhere to address it. I did a search before posting my question, however, i did not find any formal clarification. 

 

Gu 

0 Kudos
Message 6 of 16
(2,583 Views)

@edmonton wrote:

 

I agree that it may slow down the first iteration as it needs time to exclude comments in execution,  

 


That is not what wiebe meant. 😊

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
Message 7 of 16
(2,570 Views)

@Frozen wrote:

@edmonton wrote:

 

I agree that it may slow down the first iteration as it needs time to exclude comments in execution,  

 


That is not what wiebe meant. 😊


For even more clarity:  Wiebe was including the time for you to type the comment in the "first iteration".


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 8 of 16
(2,546 Views)
Solution
Accepted by topic author edmonton

@edmonton wrote:

Thank you all for your replies.

 

I agree that it may slow down the first iteration as it needs time to exclude comments in execution, once compiled, comments should have no effect on execution. 

 

Gu 


Not so.  First the compiler is always running so the darn LV executable object is either compiled and ready to run or the run arrow is broken.

 

Now, if you need more than the object like, the block diagram or the Front panel to be loaded.  Example; placing either into a subpanel by a dynamic call.  The memory size would certainly impact load time and the caller's execution, but NOT the execution time of the vi called. 

 

Technically,  you COULD place a huge picture on the either panel and it it essentially a comment or decoration.  But that's order's of magnitude different from a rather short text comment's memory footprint.


"Should be" isn't "Is" -Jay
Message 9 of 16
(2,521 Views)

Hi 

 

Did you mean that LB does compiling all the time along with any code changing, no need compiling before execution?

 

My understanding may be wrong. My understanding is that LB just checks code's grammar, and does compiling immediately after a run is clicked, then runs the compiled code thereafter. 

 

Gu

 

 

0 Kudos
Message 10 of 16
(2,498 Views)