From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Tunnels vs Shift Registers

Solved!
Go to solution

@RTSLVU wrote:

@Mark_Yedinak wrote:

I would bet that the compiler could do a better job of optimizations when it is a tunnel since it is explicit that it will not change inside the loop. A shift register would indicate that the value might change and therefore some optimizations may not be allowed.


From what I understand anytime you have a tunnel entering a loop it pretty much negates any optimizations so SR or FN makes no difference in that aspect.


I would go for a tunnel, because it's at least as good or maybe better, and clearer to human readers.

 

The only reason for using a SR would be if the compiled code would benefit from it. I think we all agree that's not going to the case?

0 Kudos
Message 11 of 12
(254 Views)

@RTSLVU

 


Having to set the starting value inside the loop sounds like a corner case to me. 

One example is when using a fixed length queue as a pre-trigger buffer.

When you flush the queue you get an array of "chunks of data".

In the For Loop to reassemble the data, the first iteration provides the starting value.

Subsequent iterations append data.

 

steve

--------------------------------------------------------------------------------------------------------------------------
Help the forum when you get help. Click the "Solution?" icon on the reply that answers your
question. Give "Kudos" to replies that help.
--------------------------------------------------------------------------------------------------------------------------
0 Kudos
Message 12 of 12
(239 Views)