Lazily registering hooks?

Jelmer Vernooij jelmer at samba.org
Tue Jun 1 18:32:23 BST 2010


On Tue, 2010-06-01 at 13:20 -0400, John Yates wrote:
> The idea remains.  Whatever the overhead, once evaluated and
>  persistently cached, so long as the source text (both in the bzr core
>  and under the plugin directory) remains unchanged would not the cache
>  remain valid?
The plugin source code does more than just register hooks so we'll
always have to execute it.

It's true that a cache could be kept up to date as long as the source
code doesn't change, but what would that gain us exactly? It'd just add
overhead because we need to verify that the cache is not out of date,
with no clear benefit that I can see.

Perhaps I don't completely understand what you're proposing?

Cheers,

Jelmer

> 
> -----Original Message-----
> From: Jelmer Vernooij [mailto:jelmer at vernstok.nl] 
> Sent: Tuesday, June 01, 2010 1:11 PM
> To: John Yates
> Cc: John Arbash Meinel; bazaar at lists.canonical.com
> Subject: RE: Lazily registering hooks?
> 
> 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.
> 
> Cheers,
> 
> Jelmer
> 
> > ________________________________________
> > From: bazaar-bounces at lists.canonical.com 
> > [bazaar-bounces at lists.canonical.com] On Behalf Of Jelmer Vernooij 
> > [jelmer at samba.org]
> > Sent: Sunday, May 30, 2010 1:01 PM
> > To: John Arbash Meinel
> > Cc: bazaar at lists.canonical.com
> > Subject: Re: Lazily registering hooks?
> > 
> > On Sun, 2010-05-30 at 11:56 -0500, John Arbash Meinel wrote:
> > > 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?
> > > 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.
> > That doesn't seem too bad actually, especially given this could all be 
> > done under the covers in bzrlib.hooks (and the plugins would have to 
> > be updated, of course).
> > 
> > > 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.
> > Yeah, that's probably not the best idea. The fact that plugins "just 
> > work" is one of the nicest things about them in Bazaar.
> > 
> > Cheers,
> > 
> > Jelmer
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20100601/190963ff/attachment.pgp 


More information about the bazaar mailing list