[Twisted-Python] Ticket #8244 (old-style decorator)

L. Daniel Burr ldanielburr at me.com
Wed Mar 23 10:22:04 MDT 2016


Hi Glyph,

On March 22, 2016 at 11:27:10 PM, Glyph (glyph at twistedmatrix.com) wrote:


On Mar 22, 2016, at 12:33 PM, L. Daniel Burr <ldanielburr at me.com> wrote:

Hi all,

Hi Daniel,

I tried to comment on the ticket, but SpamBayes rejected it as spam.

The spam-monitoring queue is empty, which means another admin probably got to this before I did.  But when I plugged the following paragraph in, something about it made spambayes think it was still 70% likely that it was spam.  So, I re-trained the filter repeatedly until it came out to <1%; you should have less trouble with it in the future.


Thanks for looking into that, I appreciate it.

As a person who runs twisted apps via Pypy whenever possible, I wanted to point out that this ticket may result in a performance regression: according to http://pypy.org/performance.html, "Classes that inherit from both new- and old-style classes are extremely slow; avoid at all costs."

In fact, the opposite is true!  Right now, every new Twisted class must be new-style, so if it inherits from an old-style class we end up in this situation.  Since most core Twisted superclasses are old-style, that means this happens all the time.

Nothing about 8244 would involve making more hybrid classes.  Classes decorated as @oldStyle must be pure old style (the semantics of hybrids are much, much closer to new-style than old-style) so they have to be what they are today.  When we flip the switch there will be no more old-style classes at all.

Is there a scenario I'm missing / not understanding about the way the ticket's steps are outlined?


I’m thinking of a twisted.web service at the moment.  Right now, most of the classes involved (resource.Resource, http.HTTPChannel, http.Request and server.Request, etc.) are old-style classes, and pypy does a reasonable job of optimizing those, if not to the degree that new-style classes may be optimized.  My concern is that, should these classes be converted into hybrids via the @oldStyle decorator, my service may experience some reduction in the number of requests per second that it handles.  Obviously I’m using pypy because it gives my twisted.web service a substantial improvement in terms of the number of requests per second that it can handle.

I understand that I can set TWISTED_NEWSTYLE to 0 and sidestep this potential performance hit, but it is a detail that has to be communicated to various devops teams, has to be kept track of across environments, should probably be removed once a fully-converted release of Twisted arrives, and so on.

Yes, I’m being a bit of a whiner here (apologies), and clearly the feature can be disabled, and I should definitely test the results to see if there *is* a performance regression in my case.

Thanks,

Daniel
--
L. Daniel Burr
ldanielburr at me.com
(312) 656-8387
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20160323/22479937/attachment-0002.html>


More information about the Twisted-Python mailing list