[MERGE] Various hackery to reduce startup time.

Andrew Bennetts andrew at canonical.com
Sun Sep 14 14:59:40 BST 2008


John Arbash Meinel wrote:
[...]
> > 
> > Maybe we can make it be an object other than a str that warns when its __str__
> > is invoked?
> 
> I thought about that, but I figured the typical use is:
> 
> foo.decode(bzrlib.user_encoding)
> 
> And I don't think that invokes str() at any time (I'm not positive about
> that, and if we *could* find something, that would be great.)

Hmm, true.  But it would invoke __eq__, I think, as part of finding the
corresponding codec in the codecs registry...

> > Oops.  Fixed.  (There's probably other improvements that could be made to the
> > imports in this module, but then bzrlib/weave.py isn't really that important.)
> 
> It isn't specifically important, but it may get pulled in when probing
> for disk formats. (Because we have a MetaWeave, etc.) We'll have to
> check for that sort of thing. I would guess it shows up with "bzr
> status" in a subdirectory. Because we probe "breadth first" across all
> formats per directory before chdir().
> 
> We *might* want to consider probing the default format across many
> directories, but I don't know if that will be a big win. (I *do* seem to
> remember that Branch.open() is far more expensive than I would expect it
> to be.) Testing here shows "Branch.open()" at about 4.4ms, and open +
> lock/unlock is 6.0ms, which didn't seem as bad as I thought.

Interesting!

Of course, my patch is just an incremental improvement.  We can always look at
trimming those 6ms down later :)

-Andrew.




More information about the bazaar mailing list