RFC: startup time - again

John Arbash Meinel john at arbash-meinel.com
Tue Sep 9 22:23:57 BST 2008


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Robert Collins wrote:
> On Tue, 2008-09-09 at 10:08 -0500, John Arbash Meinel wrote:
>> Also, encouraging plugins to be more lazy. I know if I don't supply
>> '--no-plugins' the import overhead changes to certain plugins that
>> preemptively load all of branch, repo and workingtree.
> 
> For me, the big thing to remember is that most commands want a tree
> object, which implies that triple of class types anyway; we need to
> reduce the cost of _using_ these things. - e.g. making loading repo so
> cheap its nearly a no-op.
> 
>> errors.py is a bit hidden in my --profile-imports testing, because it
>> is
>> always imported with other things. So it is unclear which one is
>> really
>> spending all of that time.
>>
>> I *do* remember it being significant. But 15ms is small compared with
>> 60ms in get_user_encoding() and 50ms in configobj.
> 
> True.
> 
> 60ms is 10% runtime.
> :!time python -c 'import
> locale,codecs;codecs.lookup(locale.getpreferredencoding())'
> 
> real    0m0.036s
> user    0m0.032s
> sys     0m0.008s
> 
> How long is that for you?
> 
> -Rob

Well, I just rebooted to Linux to put the 1.7rc1 out.

But doing:

TIMEIT "subprocess.call('python -c \"import locale;
locale.getpreferredencoding()\"')"

is 12.4ms per loop

Adding 'codecs' and 'codecs.lookup' and it stays around 12ms.

'import bzrlib' is 48.9ms.

Note that manually running "time python -c ..." the times change by at least
20ms. (I see it jumping up to 38ms fairly often).

TIMEIT "bzr --no-plugins rocks" is
82.8ms

TIMEIT "bzr --no-plugins st" is
190ms

TIMEIT "import bzrlib.util.configobj.configobj" is
48.9ms

So even if 'import locale' is only 12.4ms, it is 12.4ms / 48.9ms of the time
to 'import bzrlib'. And it is *much* slower on win32. (rocks is 500ms versus
82.8ms)

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFIxultJdeBCYSNAAMRAp/hAKCVjHrYM7ZILOGFs5xNCPigcf6JhwCgq1L4
IKyFiz+nRRqVOP88nr0osNg=
=H1zN
-----END PGP SIGNATURE-----



More information about the bazaar mailing list