[merge] use lazy imports

John Arbash Meinel john at arbash-meinel.com
Fri Oct 6 09:29:06 BST 2006

Hash: SHA1

John Arbash Meinel wrote:
> The attached patch starts making use of the lazy_import functionality
> that got merged into bzr-0.11.
> This requires a bit of changes to the code base, since it starts
> changing things to import modules, rather than importing members of
> modules (which is generally recommended anyway).


> I apologize in advance for this being a 3K line patch, and I'll try hard
> to submit smaller changes in the future.
> John
> =:->

Attached is a follow up patch which continues to find unnecessary
imports and decreases startup time. I've been able to drop the 'bzr
rocks' time all the way down to 116ms. (After this patch, bzrlib.errors
doesn't need to be imported for 'bzr rocks', which shows that errors can
really be imported late).

This is still a large patch (1K lines), because when you start lazy
importing errors.py, you have to change all of the places that use to
expect to have the error class in the local namespace.

Next I'll probably focus on getting the 'bzr status' startup time to be
small. (And maybe 'bzr diff' after that).


Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: more_lazy_import.diff
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20061006/f6aa0e47/attachment.diff 

More information about the bazaar mailing list