This new VI polls for all events, including POLLOUT. Given the purpose of the VI, is there an opportunity for a performance improvement if the call to zmq_poll.vi is given "poll type" = [ZMQ_POLLIN && ZMQ_POLLERR] for every socket? It would eliminate the case structure inside the FOR loop.
In this implementation, I'd also suggest replacing zmq_poll.vi with a modified copy of its code that initializes the "evt" array with the correct value and eliminates the Replace Array Subset prim.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I had a go at making poll() more user friendly, it's now polymorphic as you suggested. I've changed recv_event to poll on POLLIN only, but the structure cannot be removed because if no data is received on a socket, it will return 0 for that socket, and recv() will hang waiting for data.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Very nice, thank you! Incidentally, the polymorphic VI doesn't have an icon that matches the library template, so it looks wrong in the functions palette. And the "Array type" instance is the default, while the "Scalar type" instance will execute faster (by a trivial fraction). I recommend setting the poly VI to show its selector by default.
Last edit: Stobber 2013-10-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
This new VI polls for all events, including POLLOUT. Given the purpose of the VI, is there an opportunity for a performance improvement if the call to zmq_poll.vi is given "poll type" = [ZMQ_POLLIN && ZMQ_POLLERR] for every socket? It would eliminate the case structure inside the FOR loop.
In this implementation, I'd also suggest replacing zmq_poll.vi with a modified copy of its code that initializes the "evt" array with the correct value and eliminates the Replace Array Subset prim.
I had a go at making poll() more user friendly, it's now polymorphic as you suggested. I've changed recv_event to poll on POLLIN only, but the structure cannot be removed because if no data is received on a socket, it will return 0 for that socket, and recv() will hang waiting for data.
Very nice, thank you! Incidentally, the polymorphic VI doesn't have an icon that matches the library template, so it looks wrong in the functions palette. And the "Array type" instance is the default, while the "Scalar type" instance will execute faster (by a trivial fraction). I recommend setting the poly VI to show its selector by default.
Last edit: Stobber 2013-10-18
I've updated it in v1.5.2.83. POLLERR got removed because apparently it doesn't do anything anyway.