RFC: startup time - again
Andrew Bennetts
andrew at canonical.com
Tue Sep 9 13:30:38 BST 2008
Andrew Bennetts wrote:
> Robert Collins wrote:
[...]
> > There are lots of contributing factors to this, but the basic problem
> > is:
> > - we're loading too much code.
>
> Agreed.
>
> I'd love to quantify this more though.
One more random statistic: it takes just under 1ms to to execute the pile of
register_transport_proto etc calls at the bottom of
bzrlib/transport/__init__.py. That's nearly twice as long as the rest of the
non-import top-level code in that module (which is basically just class and
function definitions).
(I measured by taking time.time() before and after that code and printing the
difference.)
This seems acceptable to me, but it does illustrate that once the bytecode is
loaded into memory actually executing the “class” and “def” statements are
pretty quick compared to other code that might be executed at import time.
Although errors.py is very close to purely just definitions and takes ~14ms... I
guess it's just that >300 exception definitions is a lot. (So we can define
about 20 errors per millisecond, I guess?)
-Andrew.
More information about the bazaar
mailing list