Does the number of mio::Poll objects affect performance?


#1

I am a noob and quite new to lower level of programming. So sorry for asking such a noobish question, can I have more than one Poll object? Will that reduce performance in any way?


#2

I suggest you clarify your question. It is a bit unclear what performance you mean and what you relate it to. In general, objects require heap or stack memory to be allocated on, so this is one factor to consider. Various algorithms do not scale well with scaling number of objects being processed, this is the second factor. Poll calls are blocking, so you would not be able to utilize more poll calls at a time than total number of threads you have got.


#3

You probably wouldn’t have many Poll objects, perhaps at most one per CPU. Consider that Poll on Linux would be a wrapper over an epoll kernel structure. For a good intro to epoll, look at https://medium.com/@copyconstruct/the-method-to-epolls-madness-d9d2d6378642.