LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

"Loop invariant code motion" Did you know this and why didn't you tell me?

Solved!
Go to solution

Hi Ben,

 

now you mentioned your source I remember this topic was explained in the Performance course.

But:

In the very same course we made some examples (using LV2009) regarding this matter. It turned out to be faster when I didn't trust the compiler to be clever enough. Fastest VI had all constant operations outside of loops...

Lessons learned from the course: Don't rely on the compiler Smiley Wink

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 11 of 14
(1,096 Views)

GerdW wrote:

Hi Ben,

 

now you mentioned your source I remember this topic was explained in the Performance course.

But:

In the very same course we made some examples (using LV2009) regarding this matter. It turned out to be faster when I didn't trust the compiler to be clever enough. Fastest VI had all constant operations outside of loops...

Lessons learned from the course: Don't rely on the compiler Smiley Wink


Thanks for confirming!

 

I would like to hear more about this myself since I could find no other references to this topic aside from what I posted.

 

This would be a good oppertunity for an NI Application Engineer to go find someone in R&D who can "lift the hood" a little more.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 12 of 14
(1,070 Views)

Ben wrote:

GerdW wrote:

Hi Ben,

 

now you mentioned your source I remember this topic was explained in the Performance course.

But:

In the very same course we made some examples (using LV2009) regarding this matter. It turned out to be faster when I didn't trust the compiler to be clever enough. Fastest VI had all constant operations outside of loops...

Lessons learned from the course: Don't rely on the compiler Smiley Wink


Thanks for confirming!

 

I would like to hear more about this myself since I could find no other references to this topic aside from what I posted.

 

This would be a good oppertunity for an NI Application Engineer to go find someone in R&D who can "lift the hood" a little more.

 

Ben


Humans program the computer. Therefore, I try to inject my common sense wherever possible and use the compiler's "smarts" more as a backup to anything I miss, rather than using it as a frontrunner in "making" decisions for me.

 

That said, I don't think anyone here is suggesting you should just assume the compiler will clean up everything, but in my opinion, it's not terribly difficult to move loop invariant code outside the loop on your own, so just try to do it from the start.

Message 13 of 14
(1,052 Views)

for(imstuck) wrote:
...

Humans program the computer. Therefore, I try to inject my common sense wherever possible and use the compiler's "smarts" more as a backup to anything I miss, rather than using it as a frontrunner in "making" decisions for me.

 

That said, I don't think anyone here is suggesting you should just assume the compiler will clean up everything, but in my opinion, it's not terribly difficult to move loop invariant code outside the loop on your own, so just try to do it from the start.


Agreed!

 

I have posted many times that to master LV we have to understand how our gestures and inuendos (sp?) are interpreted by the wonderful assisstant we know as LabVIEW. The more we know about the character of that assistant, the control we have over what is actually compiled.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 14 of 14
(1,045 Views)