Comment 2 for bug 903180

Revision history for this message
Jelmer Vernooij (jelmer) wrote : Re: [Bug 903180] Re: extends python path, slowing down python imports

On 12/12/2011 05:29 PM, Rodney Dawes wrote:
> For the ubuntuone namespace projects at least, we need to do this, so
> that Python can import all our code properly, without having dependency
> hell as a result; and so that we can actually test code in a source
> checkout on a system that has the packages installed to the system.
Is it really necessary to have so many though, wouldn't one be sufficient?

>
>
> For ubuntu-sso-client, this isn't actually necessary, so we can probably
> remove it from there.
>
> Do you have any real numbers to compare with?
It seems to add some overhead for each failed import. Failed imports
aren't impossible - some things use import to see if their dependencies
are present. On my system it adds something like 0.013s (looking at
strace) to the bzr startup time from the ubuntuone pth files alone.
That's not a huge impact - the total startup time for bzr here is 0.25s.
It does contribute to the overal overhead though - and it doesn't just
impact bzr, but anything in Python that has one or more failing imports.
Ubuntuone isn't the only application that adds a pth file, but it is the
only that adds so many.

I don't think this urgently needs fixing or anything like that, but it
did seem significant enough to file a bug about.

Cheers,

Jelmer