[Twisted-Python] log.callWithLogger not used - slows down reactor?

Barry Scott barry.scott at forcepoint.com
Wed Jun 3 03:51:18 MDT 2020


On Wednesday, 3 June 2020 08:07:37 BST Glyph wrote:
> > On Jun 2, 2020, at 4:54 AM, Barry Scott <barry.scott at forcepoint.com>
> > wrote:
> > 
> > I'm hunting down performance issue in our code and spotted this in
> > passing. As far I can tell nothing seems to need callWithLogger.
> > 
> > I ran our 6k+ tests with this patch applied and everything worked.
> > 
> > Does anything in the twisted world need it?
> > 
> > Barry
> > 
> > diff --git a/src/twisted/internet/pollreactor.py b/src/twisted/internet/
> > pollreactor.py
> > index 6db1660b9..6901e5c95 100644
> > --- a/src/twisted/internet/pollreactor.py
> > +++ b/src/twisted/internet/pollreactor.py
> > @@ -165,7 +165,7 @@ class PollReactor(posixbase.PosixReactorBase,
> > 
> > posixbase._PollLikeMixin):
> >                 # Handles the infrequent case where one selectable's
> >                 # handler disconnects another.
> >                 continue
> > 
> > -            log.callWithLogger(selectable, _drdw, selectable, fd, event)
> > +            _drdw(selectable, fd, event)
> > 
> >     doIteration = doPoll
> 
> I think that we may have eliminated all the dependency on it.  Do your logs
> look any different with this change applied?  If you can demonstrate its
> impact on speed.twistedmatrix.com <http://speed.twistedmatrix.com/> maybe
> we can go ahead and do this.  The logger used to be far more dependent on
> this, but the "system" portion of the log message is now based more on who
> is doing the logging than what socket provoked the event (which is what
> this is tracking, effectively).

Curious, if its dead code why do you need a speed test? For your comment
it seems you planned to stop using this.

What is it I would need to do for a speed test?

Barry


> 
> -glyph






More information about the Twisted-Python mailing list