Scott, It looks like I was probably wrong in my earlier message. I did a quick test of the situation where I thought LV2 globals could improve on queues, but the LV2 globals were actually worse than the queues. The test pushed 1000 arrays of 1000 random numbers each through the queue or global, and used Array Max & Min to find the index of the maximum for each array. My thought was that the global could index its buffer in place, perform the analysis function, and return the result, whereas the queue would have to make a copy as the data was read. But as you point out, the queue doesn't need to retain a copy of the data after it's read, so it doesn't have to perform any copying either.
The original project where I saw the advantage had a somewhat different situation that really did show an advantage to a LV2 style global. I was performing a data acquisition in a time critical thread, decimating the data for display in the user interface, and also buffering the full set of data to disk. Since the data was going two places, a single queue wouldn't work. And by putting the decimation into the LV2 global, I was able to have the user interface thread perform that work without needing a full copy of the data.
--David Moore
At 02:01 AM 2004-05-20 -0400, you wrote:
Subject: Re: LV2 style globals, events. Was Re: DAQmx, etc. From: "Scott Hannahs" <[EMAIL PROTECTED]> Date: Wed, 19 May 2004 09:55:35 -0400
At 6:04 -0600 5/19/04, David A. Moore wrote: >If you're passing LARGE data, probably not, because LV2 style globals >are more efficient than queues i.e. you can avoid making extra copies >of the data.
Interesting. Does anyone know why a queue would make extra copies of data. I haven't tried pushing MBytes thru queues but there doesn't seem to be any inherent reason that a queue would make extra copies of the data. It should make a copy upon entering the data into the queue and the caller would release it. Upon dequeue the queue should release the memory and the receiving VI would copy it. (Note: these may not be actual copies but passing of pointers).
This should be equivalent to a LV2 style global with a USR? The exact same memory allocation/deallocation should take place.
I guess the real test is to make a couple of benchmarks and profile it.
-Scott
-------------------------------------------------------------------------
-W-H-E-A-T-W-H-E-E-L-L-E-N-S-T-O-W-I-N-D-O-W-I-N-G-G-P-R-O-G-R-A-M-W-E-B-
-------------------------------------------------------------------------
-- David A. Moore ----------------------------- Moore Good Ideas, Inc. --
-- (801) 773-3067 --------------------------------- NI Alliance Member --
-- 1996 Allison Way --------------------------- www.MooreGoodIdeas.com --
-- Syracuse, Utah 84075 ------------- [EMAIL PROTECTED] --
-------------------------------------------------------------------------
