[alsa-devel] Single vs. multiple seq client ports
Hi. Our app currently uses a single alsa midi seq client port to address all external midi ports.
I have an opportunity now to change this to allow as many client ports as desired, for example one client port for each external port found.
If I proceed, it is possible the user may have many client ports if desired.
What are the advantages and disadvantages if any, in terms of speed and resources, of having a single client port versus multiple client ports?
Thanks. Tim.
Tim E. Real wrote:
What are the advantages and disadvantages if any, in terms of speed and resources, of having a single client port versus multiple client ports?
A port itself does not need much memory (it's just the name and other metadata); as far as events are concerned, a port is just a number. Events are stored in a client's buffer (in the sender's when they are queued, in the receiver's when they are delivered).
A client's ports are stored in a linked list, and are looked up when events are transmitted, so you should not have a very large number of ports.
When the ports are visible to the user (because you want him to be able to make connections dynamically), using multiple ports allows you to expose different parts of your application (and use different permissions, if this makes sense). If the ports are not visible, it might make sense to have multiple ones if you use the port number for routing.
Regards, Clemens
participants (2)
-
Clemens Ladisch
-
Tim E. Real