hfettig Posted February 1, 2008 Report Share Posted February 1, 2008 Hi, Does anybody know how the notification/element in a notifier/queue is passed between the Send Notification/Enqueue Element and the Wait For Notification/Dequeue Element functions? It probably makes little difference whether it is passed By Reference or By Value for the standard data types, but if for some reason the payload would be a large array or a large waveform it could have a large impact on performance. Cheers, Heiko Quote Link to comment
Yair Posted February 1, 2008 Report Share Posted February 1, 2008 Queue elements are passed by references (at least for the Dequeue primitive, which creates a 1-to-1 relationship), making them very efficient. I remember Stephen saying that notifiers use the same basic code underneath, so I would guess that the first WFN node uses by-ref and that any other creates a copy. Quote Link to comment
hfettig Posted February 2, 2008 Author Report Share Posted February 2, 2008 QUOTE(Yen @ Jan 31 2008, 02:56 PM) Queue elements are passed by references (at least for the Dequeue primitive, which creates a 1-to-1 relationship), making them very efficient. I remember Stephen saying that notifiers use the same basic code underneath, so I would guess that the first WFN node uses by-ref and that any other creates a copy. Thanks, Yen I suspected as much. I ran a little comparison, which showed that there was 0ms delay between enqueuing and dequeuing a 10,000,000 array of double. I suspect that it would take slightly longer if the array were passed by reference ;-) Cheers, Heiko Quote Link to comment
Aristos Queue Posted February 2, 2008 Report Share Posted February 2, 2008 QUOTE(Yen @ Jan 31 2008, 01:56 PM) Queue elements are passed by references (at least for the Dequeue primitive, which creates a 1-to-1 relationship), making them very efficient. I remember Stephen saying that notifiers use the same basic code underneath, so I would guess that the first WFN node uses by-ref and that any other creates a copy. Notifiers use the same trick when *sending* the data to the Notifier, but the "Wait for Notification" node is not the same as a "Dequeue" node. Wait for Notification behaves the same as Preview Queue -- which means that a copy of the data is made instead of just moving the data onto your output wire. The reason is that the Notiifer has to retain its value for any other Wait For Notification node that exists on other block diagrams. Summary: No copies when sending to notifier or enqueuing into a queue (assuming you haven't forked the wire going into the Enqueue function in such a way that the *fork* makes a copy) No copies when dequeuing from a queue. Copies when previewing a queue or waiting for a notification. Quote Link to comment
Yair Posted February 3, 2008 Report Share Posted February 3, 2008 QUOTE(Aristos Queue @ Feb 1 2008, 04:53 PM) The reason is that the Notiifer has to retain its value for any other Wait For Notification node that exists on other block diagrams. Seems perfectly obvious when you just to think about it for a second (which I didn't). P.S. Is it proper syntax to put the smiley after the period? Quote Link to comment
crelf Posted February 3, 2008 Report Share Posted February 3, 2008 QUOTE(Yen @ Feb 2 2008, 01:40 PM) Seems perfectly obvious when you just to think about it for a second (which I didn't). P.S. Is it proper syntax to put the smiley after the period? I don't think so - I think that suggests that the smiley has something to do with the next sentance 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.