I just discussed those comments with Jim via IRC. The following comments are
On Friday 12 May 2006 08:56, Jim Fulton wrote:
> > directives have to be reviewed and it must be ensured that they are
> > multi-site aware. The tricky part of the implementation will be to hook
> > in those sites as bases to local sites. It must be ensured that the ZODB
> > can load having filesystem-based sub-sites, error handling must be
> > carefully considered and an UI must be written.
> The pickling aspects are pretty trivial. I'm not sure what UI you are
> refering to.
I am referring to the UI that lets you select the IComponents utilities that
will act as bases for the local site. After the discussion it became clear
that once the pickling is done correctly, it is no problem.
> > The second approach is to reduce the ZCML processing time, which could
> > be integrated into the reload mechanism for Zope 2. This can be
> > accomplished by storing some binary representation of the ZCML, similarly
> > to ``*.pyc`` files in Python. Again there are several choices to consider
> > and they should probably all be tried. The first solution would be to
> > store a pickle of each parsed directive, namely the action and its
> > arguments. There would be one pickle file fore each ZCML file. When the
> > ZCML file changed, the pickle would be updated. Pickle loading would be
> > much faster than pure ZCML loading, since no XML-parsing, value
> > conversion and schema validation would be necessary.
> Note that this will require a refactoring of ZCML handlers to define
> picklable actions. This will also require refactoring so that work now
> done by handlers be defered to action execution.
As I explained to Jim on IRC, I am not proposing pickling the configuration
actions, but the configuration handler callable and its arguments. For
functions, this is trivial to do. For complex directives that use classes
this is a little bit harder, but not much.
We will still have the benefit of saving value conversion and validation, as
well as XML parsing (though I am not sure whether pickle parsing is faster).
The approach is also much safer, since it does not depend on the subtleties
of directives, which is good. Not only are actions often unpickable, but some
directives also do not generate actions, but do their work directly; this is
due to some bootstrap issues. An approach pickling actions would miss those
registrations. The more I think about this, the more I believe this is the
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
Zope3-dev mailing list