[Twisted-web] Re: [Nevow-commits] r1003 - Don't call getInterfaces over and over and over again

Donovan Preston dp at ulaluma.com
Fri Dec 24 20:06:58 MST 2004


On Dec 24, 2004, at 6:38 PM, James Y Knight wrote:

>
> On Dec 24, 2004, at 5:46 PM, Donovan Preston wrote:
>> Modified:
>>    branches/dp/optimizations/nevow/flat/ten.py
>> Log:
>> Don't call getInterfaces over and over and over again
>
> I'm pretty sure zope interfaces already caches this operation, so 
> doing a double cache may actually be detrimental. But, measurements, I 
> guess...

Flatteners don't actually use the main adapter mechanism any more, 
since what you register is a two-argument callable, not a "real" 
adapter. Out of all the optimizations I performed, this one was the one 
that provided one of the biggest speedup.

>> Modified:
>>    branches/dp/optimizations/nevow/flat/flatstan.py
>> Log:
>> Optimize out some function calls (from property accesses)
>
> Why does it need a _specials dict anyways? What's wrong with just 
> using the instance dict for those?

Yeah, the instance dict should probably be used. It does make it easy 
to check if a node has specials though. I have been thinking about 
moving the slotData dict into the specials dict to make the check even 
easier. I'm going to write a bunch more tests and then have a stab at 
refactoring some of the lower level code to be cleaner.

I'm not sure why Tag doesn't have a __slots__ declaration? I think it 
used to.

dp




More information about the Twisted-web mailing list