[merge] python 2.5 fixes
John Arbash Meinel
john at arbash-meinel.com
Mon Sep 25 21:05:47 BST 2006
Aaron Bentley wrote:
> John Arbash Meinel wrote:
>
>>> If you don't want to change the ElementTree sources (which I think we
>>> should, and contribute the changes upstream). I can modify
>>> 're.compile()' before importing elementtree, and then restore it afterwards.
>
> Hmm. Aren't a lot of our startup time issues due to regex compilation?
>
> I wonder whether Python should make _sre.SRE_Pattern objects lazy?
>
> Aaron
It isn't the only thing. "import bzrlib.errors" actually takes 3-6ms to
import, just because it is creating lots of classes. That said, it is
the #1 startup cost.
So even though regex compilation *is* expensive (it can take 25ms to
compile a single regex). There are other things which cost us time as well.
I'm hoping to move some of my 'lazy_import' fixes into bzr for 0.12, and
then after Registry gets merged, start splitting up our 'cmd-*' classes,
as well as our Branch & Repository formats.
Which should mean that in a default run, very little extra code needs to
get imported. I already have a lot of the lazy_import stuff done. But I
want to merge it early in a new cycle, rather than late. So that bzr.dev
gets a lot of pounding.
One problem with testing lazy import with out test suite, is that
basically our test suite imports *everything* so you don't notice import
dependency issues. Like the fact that just doing 'import
bzrlib.repository' fails because it imports bzrlib.revision_tree which
imports bzrlib.tree which imports bzrlib.revision_tree causing a
dependency cycle (because RevisionTree used to be defined in bzrlib.tree).
Which is technically deprecated, but since we don't have a way to force
a 'DependencyWarning' when accessing an object in the wrong module, I
don't think it is safe to remove it.
John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060925/d1ef9eda/attachment.pgp
More information about the bazaar
mailing list