> On Mar 23, 2016, at 2:10 PM, L. Daniel Burr <ldanielb...@me.com> wrote:
> 
> Hi Glyph,
> On March 23, 2016 at 1:39:53 PM, Glyph (gl...@twistedmatrix.com 
> <mailto:gl...@twistedmatrix.com>) wrote:
> 
>> 
>>> On Mar 23, 2016, at 9:22 AM, L. Daniel Burr <ldanielb...@me.com 
>>> <mailto:ldanielb...@me.com>> wrote:
>>> 
>>> 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
>> 
>> If oldStyle converts the classes into hybrids, then it's broken.  Hybrids 
>> don't follow the semantics of old-style classes.  So this won't happen.
>> 
>>>  I should definitely test the results to see if there *is* a performance 
>>> regression in my case.
>> 
>> My guess is that this is an insignificant micro-optimization and that pypy 
>> has gotten better at optimizing hybrids since that caution was written.  
>> That said, we're really bad at paying attention to speed.twistedmatrix.com 
>> <http://speed.twistedmatrix.com/> and we really need a way to see pre-merge 
>> performance metrics rather than just a graph over time.
>> 
> 
> In the interest of putting my money where my mouth is, I’ve tested a very 
> simple case, where I create a class inheriting from 
> twisted.web.resource.Resource, and a subclass which mixes in “object”:

Thanks for doing this.
> So, not a huge difference, overall, and it might not even be visible over a 
> long enough period of time.

Glad to hear it :).

With this in mind, my recommendations to most Twisted users is to start tacking 
on ", object" to the end[1] of your inheritance hierarchies, so that you get 
hybrid classes now, which will help you sort out any problems you will have by 
going fully new-style, at the cost of a small performance hit.  It'll be easier 
to suffer through <1% performance hit (0.7% by your metrics) for the next few 
releases and change nothing when the new-style release happens, than to be 
concerned about it breaking stuff.

-glyph

[1]: The end and ONLY THE END of the hierarchy; if you put 'object' first then 
when those classes go new-style you'll get an exception when declaring the 
class.

_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to