eaolson Posted January 16, 2008 Report Share Posted January 16, 2008 I'm cleaning up a quick-and-dirty app I wrote which is turning out to be something more useful than I originally expected. What I'm thinking of turning this into would have one loop running continuously doing data acquisition and periodically a user-fired event would save the data. Data will be stored in an array. So what I'm thinking of having a single element queue to store the array. The DAQ loop dequeues the array, appends the new element, and re-queues the array. The save loop can get a snapshot of the array at any time by previewing the array and saving it to disk. Attached is sort of a sketch of what I'm thinking of. My concern is that in the dequeue-append-enqueue process, the Dequeue node has a buffer allocation on the output, I assume making a copy of what's in the queue. If the array gets large, I'm worried that will slow things down. On the other hand, I notice that neither the append or the enqueue has a buffer allocation. So maybe I'm misunderstanding where things are getting copied, and the queue is just pushing a pointer to the array around behind the scenes. Which is it? Or is there a better way of structuring this so the DAQ loop and the Save loop each have access to the same array? (Right now, everything's in a single state machine and the user can't save the data without stopping the data acquisition.) Quote Link to comment
Aristos Queue Posted January 16, 2008 Report Share Posted January 16, 2008 > My concern is that in the dequeue-append-enqueue process, the > Dequeue node has a buffer allocation on the output, I assume > making a copy of what's in the queue. Once again: The "Show Buffer Allocations" do not show copies. They show buffer allocations. That dot on Dequeue indicates a place where a location is allocated to store data. Think of these as buckets. Data enqueued into a queue and dequeued from the queue elsewhere is not copied. It is moved from the bucket of the wire into the bucket in the queue and then moved from the bucket in the queue to the bucket on the new wire. The data is not copied; it is moved. When I say moved, I mean the top level data gets moved. For a double, that's an 8 byte value. For an array, that's a pointer, not the entire array. For a LVClass, it is also a pointer. For a cluster, it is the sum of top level data sizes of the clustered elements. Quote Link to comment
eaolson Posted January 17, 2008 Author Report Share Posted January 17, 2008 QUOTE(Aristos Queue @ Jan 15 2008, 06:05 PM) Once again: The "Show Buffer Allocations" do not show copies. Thanks. If you repeat something often enough, it can permeate even my thick skull. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.