[Zope-dev] [Zope2] ZODB load optimization ineffective due to ExtensionClass flaw

Dieter Maurer dieter at handshake.de
Wed Mar 8 10:11:10 EST 2006


The ZODB allows to include the class (a reference to it)
into persistent references in order to avoid loading the object
state when a ghost object needs
to be created for the persistent reference.

For this to work, the class must not require arguments to "__new__".
The ZODB checks whether the class defines a "__getnewargs__" method.
It it does, the ZODB concludes that its "__new__" might need arguments
and does not try to optimize.

Unfortunately, "ExtensionClass.Base" defines "__getnewargs__".
It is the base class for all Zope2 classes. Zope2 persistent
references are not optimized...


An analysis of our application revealed that the missed
optimization opportunity increases the amount of storage loads
by a factor of 4 to 5. Storage loads are often the dominating
factor -- especially for searches.


@Jim:
Is the "__getnewargs__" definition in "ExtensionClass.Base" vital?
It returns the empty tuple. Thus, there seems to be a chance to
get rid of it.

I know that some code (especially in "ExtensionClass/picke/pickle.c")
needs to be changed as it depends on the existence of "__getnewargs__".

If you think, there is a chance to get rid of "__getnewargs__",
I can do the work and put the changes into the collector.

Zope2 might become a bit faster...


-- 
Dieter


More information about the Zope-Dev mailing list