In a nut-shell.
never use a local if you pass the data with a wire.
If a wire will not do it, try a shift register.
If the data has to be shared between multiple loops a method of sharing a shift register between threads is an Action Engine as I discuss in this Nugget.
If you "data path" has a single "reciever, use queues to pass the data.
Locals can be used effectively if you need to write to a control but should not be used as a technique for sharing data.
I hope that helps,
While we're on the topic of Local abuse.. To illustrate Ben's point, the code shown below
could SHOULD have used shift registers instead of locals.
I downloaded a bit of sample code from a pump manufacturer which claimed to have the hardware 'drivers'. I thought I'd best take a look to be safe, but it was just a simple demo of how to use VISA to communicate over RS232. Fair enough, LV is very different to text languages so a demo is always nice and helpful.
HOWEVER, the VI which does all the communicating business is a 3 frame stacked frame structure which uses both local variables to pass the VISA reference and sequence locals to pass the error cluster through all the frames. Additionally, the 'first call' primitive is used to open the VISA reference first time through, but at no point is the close VISA reference called, leaving the LV RTE to free memory.
We bought an old rig from one of our other sites with the intention of adding some post process processes to it. The accompanying hardware manual is thick, in depth and very well laid out with cross references that match up with each other and everything. It even includes the manuals for third party hardware - RS232, GPIB devices and such. My task is to add all the the extra functionality, and - hooray! It is supplied with the source code! Given the quality of the hardware manual, I was expecting the software to be of a similar standard. Ho ho ho, I think not....
There are dozens of Sub VIs and they all look like that. The code has been crammed into the view of a 1024*768 screen. All in all there are 331 Global variables, 188 local variables and 79 stacked or flat sequence structures,
Well, that's an example of taking the "No diagram bigger than the screen size" a LITTLE too far.
OTOH, the Local usage is horrendous.....
Interesting way to split the error cluster. It doesn't show the entire code, but I bet the error clusters are joined using Locals.. Just a guess.. maybe..