Jump to content

How is Notifier and Queue Data passed?


Recommended Posts

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

Link to comment

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.

Link to comment

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

Link to comment

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.

Link to comment

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? :P

Link to comment

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? :P

I don't think so - I think that suggests that the smiley has something to do with the next sentance :P

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.