Hi,
It all depends on the application. While a shiftregister is just a pointer,
it is passed every case that is executed. A lv2 global will only use
execution time in the states it is called in. Lv2 globals have an advantage
over shiftregisters/clusters, because they can be called anywhere in the
program. And you can build in nice tricks, like auto average, min max, fifo
buffers, circular buffers, etc.
Anyway, in my experience, using locals did not cause any timing problems.
Then again, some applications require max 1 Hz logging...
I'm not saying using locals is the way, I just tried it and did not find any
reason not to use it. I use lv2 globals for some data, data indicators for
other data. I also have some really bad experiences with programs using
locals.
My main reason to try the data indicator method was this. I build a template
state machine, and did like the idea that the programmer (me, and some
colleages), did not need to modify anything that was not in a case. (And I
don't like to work with clusters, it feels to me there are too much mouse
movements involved, but that is personal, and I could be wrong about it.)
Another reason was that if I could find a convenient way to document the
user indicators and controls, I could use this method for the data
indicators, one on one.
Some methods not mentioned jet;
+ Using reference files. These files are loded once, and remain in memory.
Tried it, and also has cons and pros. It is in fact an advanced lv2 global.
+ OOP-ish style. Also in fact a lv2 global. Program clearity and reuse of
code might justify any time penalty caused by lv2 global contruction used. I
don't know if this method could replace all data in a main state machine
(the top level UI). I might try it some day.
Regards,
Wiebe.
"Greg McKaskle"
wrote in message
news:3E8BBA02.7050701@austin.rr.com...
> > So, the only three alternatives we have are:
> > 1. Bundling data into one or several clusters to reduce the number of
> > shift registers and wires, resulting in unbundling or bundling the
> > needed item every time it's accessed.
> > 2. Using subVIs with unwired shift registers (LV2 style globals)
> > 3. Using local variables/controls/indicators.
> >
> > I guess using globals is out of question.
> >
> > Can anybody really rate these methods with respect to speed of
> > execution? Is, say, writing to a local in one case and then reading
> > from it in another REALLY slower than bundling into the shift register
> > and then unbundling, or passing data to a subVI and then calling it
> > again to retrieve it?
>
> I can rate them based upon what I know of LV, but I'd encourage you to
> make your own timing tests. Nothing teaches quite like practice.
>
> 1. Shift registers that flow throu without being modified are free. The
> data on the wire between shift registers is pretty much a pointer. If
> some cases modify the data, they are just writing it to the pointed
> buffer, and reading reads from the pointer. This is the fastest.
>
> 2. Each time you read from a LV2 style global, you copy the data from
> the subVI registers into the top diagram wire. Writing copies the other
> way. With the right set of operations on the LV2 style global, you have
> the most efficient global access possible, but not as good as the shift
> register in #1.
>
> 3. Locals, globals, property nodes values, all behave similar to the LV2
> style global. With simple data they will be faster as they don't have
> the subVI overhead. With complex data or large arrays, the LV2 global
> will win out since it hopefully doesn't need to access most of the data.
> Since I have no idea what your data types are, I'd put this one as a
> tie with #2.
>
> Greg McKaskle
>