[issue30014] Speedup DefaultSelectors.modify() by 1.5x

Giampaolo Rodola' report at bugs.python.org
Fri Apr 7 09:39:46 EDT 2017


Giampaolo Rodola' added the comment:

> The idea is to reuse _BaseSelectorImpl.register() and
> _BaseSelectorImpl.unregister() to factorize the code.

You can't factorize the logic of modify() into those as they do two different things. I also don't like repeating the same thing 3 times but given how the module is organized I'm not sure how to do that as I need to pass 3 things around: the low-level selector (epoll, poll, whatever) and the read and write constants (POLLIN, EPOLLIN) which change depending on the selector being used.
The same thing applies to the devpoll class (http://bugs.python.org/issue18931).
I can write a second patch which to refactor the whole module if that is desirable but I prefer to do that in another PR.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30014>
_______________________________________


More information about the Python-bugs-list mailing list