[merge] use lazy imports
John Arbash Meinel
john at arbash-meinel.com
Fri Oct 6 09:29:06 BST 2006
-----BEGIN PGP SIGNED MESSAGE-----
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.
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).
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
More information about the bazaar