[Zope-dev] Re: local namespace optimizations?

Florent Guillaume fg at nuxeo.com
Wed Jul 5 20:55:28 EDT 2006


dieter at handshake.de wrote:
> Florent Guillaume wrote at 2006-7-5 18:56 +0200:
>> Is anyone opposed to me removing the stupid:
>>         _getattr = getattr
>>         _none = None
>>         marker = _marker
>> local namespace """optimizations""" that are found in  
>> unrestrictedTraverse?
> 
> Why do you think they were stupid?

I call them stupid because they are micro-optimizations that are drowned 
in the rest of the traversal code and make things harder to read.

_none vs None are exactly the same speed in my tests.
_marker vs a global have a 0.05 microsecond difference on my machine
_getattr vs getattr too.

And if we "localize" those, why not localize aq_base as well, and 
guarded_getattr and securityManager.validate and nsParse and 
namespaceLookup...

At least the current unrestrictedTraverse() code has grown sufficiently 
complex that it should be rebenched and re-optimize if needed, but it's 
already complex enough to not keep cruft in it if it's not justified.

Florent

> 
> They do save time -- although it probably does not dominate the total time.
> 
> 
> 


-- 
Florent Guillaume, Nuxeo (Paris, France)   Director of R&D
+33 1 40 33 71 59   http://nuxeo.com   fg at nuxeo.com


More information about the Zope-Dev mailing list