[New-bugs-announce] [issue11273] asyncore creates selec (or poll) on every iteration

Марк Коренберг report at bugs.python.org
Mon Feb 21 16:49:23 CET 2011

New submission from Марк Коренберг <socketpair at gmail.com>:

select.poll() object or r,w,e arrays for select() should not be built from the start in each iteration.

For performance issue, such objects should be created in loop() function and modified in add_channel/del_channel. As we do not know, what type of event loop (select or poll) will be choosed, we must either build both (bad performance anyway) or create new class:

1. new class a-la "poller" should be created, accepting "map" and "use_poll" parameters. poll() should be moved to poller.poll()
2. The "dispatcher" class should accept "poller" as parameter (not just "map")
3. "add_channel" and "del_channel" should add/remove items in "poller" (select.poll.modify or list.remove for r,w,e)
4. "poller" should have weakref to each controlled "dispatcher" just for unregistering dead dispatchers via weakref callback.

I can create a patch, but will not start until someone approve my idea.

components: Library (Lib)
messages: 128965
nosy: mmarkk
priority: normal
severity: normal
status: open
title: asyncore creates selec (or poll) on every iteration
type: performance
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list