[Checkins]
SVN: zope.interface/trunk/src/zope/interface/interface.py
using `__setattr__` instead of `property` speeds up zope
start-up time again, since getting the value for `__bases__`
through `__dict__` adds up with almost 200.000 calls;
of course, there's some overhead, since `__setattr__` gets called for
the other attributes as well, but overall start-up is still faster
Andreas Zeidler
az at zitc.de
Thu Nov 1 14:29:41 EDT 2007
Log message for revision 81363:
using `__setattr__` instead of `property` speeds up zope start-up time again, since getting the value for `__bases__` through `__dict__` adds up with almost 200.000 calls; of course, there's some overhead, since `__setattr__` gets called for the other attributes as well, but overall start-up is still faster
Changed:
U zope.interface/trunk/src/zope/interface/interface.py
-=-
Modified: zope.interface/trunk/src/zope/interface/interface.py
===================================================================
--- zope.interface/trunk/src/zope/interface/interface.py 2007-11-01 17:59:51 UTC (rev 81362)
+++ zope.interface/trunk/src/zope/interface/interface.py 2007-11-01 18:29:40 UTC (rev 81363)
@@ -274,7 +274,7 @@
def __setBases(self, bases):
# Register ourselves as a dependent of our old bases
- for b in self.__bases__:
+ for b in getattr(self, '__bases__', ()):
b.unsubscribe(self)
# Register ourselves as a dependent of our bases
@@ -284,12 +284,12 @@
self.changed(self)
- __bases__ = property(
+ def __setattr__(self, name, value):
+ if name == '__bases__':
+ self.__setBases(value)
+ else:
+ self.__dict__[name] = value
- lambda self: self.__dict__.get('__bases__', ()),
- __setBases,
- )
-
def changed(self, originally_changed):
"""We, or something we depend on, have changed
"""
More information about the Checkins
mailing list