LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

producer/consumer efficiency

I have seen different answers to this and was wondering which one overall runs better. For a simple producer/consumer pattern is it better to use local variables, que's, or property nodes? An application of this would be something like taking data from a DAQ setup in one loop and processing in the other.
Thanks!
0 Kudos
Message 1 of 3
(2,720 Views)
If you put like that I would use queues over the other two options you stated.

Queue don't lose data if the consumer is a bit slower than the producer and you don;'t need code to prevent a sample to be consumed twice if it wasn't updated before the consumer is ready to process the next sample. With queues two sequential samples can have the same value, with the other two you could never know if it was the same sample or a new one.

If you don't need to have a sample, but only the most recent for another run of the consumer the loacl or property node would be a better choice since you don't need extra code necessary for the queue (like enqueue and dequeue, etc).

Hope it clarifies a little.
Regards,
André (CLA, CLED)
0 Kudos
Message 2 of 3
(2,710 Views)
Using local variables or property nodes will require a switch to the user interface thread, causing a performance impact. Stick with queues.
0 Kudos
Message 3 of 3
(2,689 Views)