Lazily registering hooks?

Martin Pool mbp at canonical.com
Tue Jun 1 23:35:34 BST 2010


On 2 June 2010 03:10, Jelmer Vernooij <jelmer at vernstok.nl> wrote:
> On Sun, 2010-05-30 at 13:55 -0400, John Yates wrote:
>> What about lazing caching of hook registrations validated by plugin path/size/dtm.
>> Would that not support "installation" via simple copying, registration prior to any
>> hook evaluation and preservation of low amortized overhead?
> The problem isn't really in loading the hooks themselves, we can
> trivially do that in a lazy fashion - the issue is that registering any
> sort of hook requires us to import the hook point for that hook, and
> importing that hook point can be expensive.

I think the complexity and potentially fragility of a hook is really
overkill here.  In the scheme outlined by John in this thread we would
have to load

 - one small  __init__ per plugin
 - the "please register a doubly lazy hook" code (presumably hooks.py)

and nothing else.  If we get to the point where loading every plugin
takes only one file IO and that's still not enough then we can look at
caching or combining them.

-- 
Martin <http://launchpad.net/~mbp/>



More information about the bazaar mailing list