[New-bugs-announce] [issue20275] asyncio: remove debug code from BaseEventLoop

Yury Selivanov report at bugs.python.org
Wed Jan 15 23:11:04 CET 2014


New submission from Yury Selivanov:

Can we remove debug timing around "self._selector.select(timeout)"
(or at least make it configurable) from BaseEventLoop?

Right now the code is:

        # TODO: Instrumentation only in debug mode?
        t0 = self.time()
        event_list = self._selector.select(timeout)
        t1 = self.time()
        argstr = '' if timeout is None else ' {:.3f}'.format(timeout)
        if t1-t0 >= 1:
            level = logging.INFO
        else:
            level = logging.DEBUG
        logger.log(level, 'poll%s took %.3f seconds', argstr, t1-t0)

So it makes two 'time.time()' calls per loop iteration, plus
one "logging.log" call.

The only non-intrusive solution that I can suggest is to add a
class attribute '_debug' to BaseEventLoop, set to False by default
(unittests can set it to True in their setUp methods).

----------
components: Library (Lib)
messages: 208199
nosy: gvanrossum, pitrou, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: remove debug code from BaseEventLoop
type: performance
versions: Python 3.5

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


More information about the New-bugs-announce mailing list