Lazily registering hooks?
John Arbash Meinel
john at arbash-meinel.com
Sun May 30 17:56:01 BST 2010
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Jelmer Vernooij wrote:
> IIRC there was some discussion about this at the recent sprint during
> UDS, but I wasn't there for it.
>
> One of the slowdowns for me in starting up Bazaar is importing the
> various modules that the plugins I have installed install hooks in. E.g.
> bzr-svn has to load bzrlib.info, bzrlib.diff, bzrlib.send,
> bzrlib.filters, bzrlib.version_info_formats.format_rio.
>
> It'd be great if there was some way to lazily register hooks. I don't
> have any good ideas on how to fix that without giving up some of the
> benfits that our current infrastructure has (I don't want to centralize
> all hooks in a single file). Does anybody else have ideas?
>
> Cheers,
>
> Jelmer
The best I can think of still just ends up with a central registry. The
Hook code could be localized, but it would end up saying "what bits were
interested in my hook", and then call back to have them loaded.
I don't think we can really get away from that.
Well, one option is to turn the registration into config code, that only
gets read when the hook runs, or something like that. But then the user
has to get involved, rather than just 'installing' the plugin.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAkwCmKEACgkQJdeBCYSNAANofgCdGabRpfzq0y5hh7oAIUqho7vk
n60AoNYQIxQqORyOY4aZ5nzXoHd2Wvs1
=8jl4
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list