[Zope3-dev] Re: Google SoC Project

Tres Seaver tseaver at palladion.com
Fri May 12 10:57:43 EDT 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stephan Richter wrote:

<snip>

>>>  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 right approach.


- -1.  This fact is a wart on the current system:  it means that it is
currently impossible to *parse* the ZCML file without allowing any
directive make arbitrary changes to the interpreter state.  Directives
should *never* do more than register actions.

We can remove all these issues that I know of if we make the dotted-name
checker less "eager":  rather than performing the check inline, during
parsing, it should record the name, plus file and line number, for
checking only after the actions have been run.

At that point, all actions should be trivially picklable, and we get the
bonus of being able to introspect the ZCML without actually executing it.




Tres.
- --
===================================================================
Tres Seaver          +1 202-558-7113          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEZKJn+gerLs4ltQ4RAsq1AKCTKxCxvY2pGpMoDAOi5hVr3tz50QCeLyow
kZneakUDzgu9jmo8IZXkME8=
=UGZM
-----END PGP SIGNATURE-----



More information about the Zope3-dev mailing list