LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

shift register "efficiency" question

"Don't use shift registers with large array if at all possible. LV makes a copy of the contents of a shift register for each loop iteration."

 

This comment was in some code I came accross today, and there was a read local at the beginning of the loop (inside) and write local (inside) at the end. Is this a truthful statement? Don't locals make a copy (also?)

0 Kudos
Message 1 of 6
(4,061 Views)

for(imstuck) wrote:

"Don't use shift registers with large array if at all possible. LV makes a copy of the contents of a shift register for each loop iteration."

 

This comment was in some code I came accross today, and there was a read local at the beginning of the loop (inside) and write local (inside) at the end. Is this a truthful statement? Don't locals make a copy (also?)


Re: SRs 

FALSE!

 

Re:Locals

TRUE

 

So you are correct and that comment is bogus.

 

Ben

 

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 2 of 6
(4,053 Views)
Too bad about the 7.1 version.  LabVIEW has introduced a memory management palatte in the newer revisions that can address the concerns about copies everywhere.  check out the knowlege base article "managing large data sets in LabVIEW here for some really good ideas.

"Should be" isn't "Is" -Jay
Message 3 of 6
(4,046 Views)

Awesome, I'll look into that. We have later versions floating around, I just don't have one on my machine.

I was going to say, I thought shift registers just accessed some spot in memory, and didn't copy anything.

Message 4 of 6
(4,034 Views)

for(imstuck) wrote:

Awesome, I'll look into that. We have later versions floating around, I just don't have one on my machine.

I was going to say, I thought shift registers just accessed some spot in memory, and didn't copy anything.


That is correct!

 

Of course you could force LV to do otherwise by building an array in a loop, but even then it works in a single buffer (spot in memory) provided the "spot" is big enough. Get familiar with the Show buffers that Jeff mentioned to "get the feel" for yourself.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 6
(4,024 Views)

for(imstuck) wrote:

"Don't use shift registers with large array if at all possible. LV makes a copy of the contents of a shift register for each loop iteration."


This reminds me of labuda's quote here from many years ago:


@labuda wrote:
The problem comes out when you have 500 000 items to remove from the list. If you simply use the loop + shift register, then you end up clogging your computer; because your 1 000 000 size array goes back and forth.

Despite the beatiful choice of words (clogging your computer, goes back and forth, etc.), we are dealing with a serious misconception and misinformation (read my reply in the above link).

 

...Actually, that entire thread is worth a read. 🙂

Message 6 of 6
(3,921 Views)