RFC: startup time - again
John Arbash Meinel
john at arbash-meinel.com
Tue Sep 9 22:33:26 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel wrote:
> Andrew Bennetts wrote:
> ...
>
>> I'd love to quantify this more though.
>
> Just to pimp some code I wrote a long time ago, there is still 'bzr
> --profile-imports CMD' available. It hooks into __import__ and
> re.compile as those were the big things I saw at the time. Also,
> re.compile support is broken in python2.5 because they changed the code
> path.
>
>
> I'm attaching a run of 'bzr --profile-imports st --no-plugins' on a
> bzr.dev tree on win32. (It takes ~500ms on this machine.) (I also had to
> update profile_imports to use time.clock on win32, because time.time()
> only has a 16ms resolution.)
>
> Notice that:
>
> 1) import bzrlib itself is ~100ms.
> 52ms spent in bzrlib.osutils.get_user_encoding()
> 18ms spent loading win32utils, 8ms ctypes
> 13ms loading trace, 12ms logging
> 5ms loading sha
> and
> 43ms spent loading ConfigObj.
> 23ms loading 'compiler'
>
> 2) 69ms loading "bzrlib.directory_service"
> 69ms because it brings in Branch, which brings in
> 66ms RepostoryFormatPackDevelopment
> 44ms bzrlib.repofmt.knit_repo
>
> ... 17ms loading urllib because of 12.6ms in socket
>
> 3) 45.6ms loading "bzrlib.builtins"
> 29ms bringing in bzrdir, 16ms bringing in lockdir
>
> Lazy importing can make it tricky to track it down, because things don't
> get loaded quite as 'linearly'.
As a comparison, I'm attaching the same "bzr status" in a bzr.dev tree on Linux.
Comparing the import times:
1) 100ms => 41.6ms import bzrlib
43ms => 24ms to import 'bzrlib.config'
52ms => 13ms for get_user_encoding
2) 45.6ms => 28ms bzrlib.builtins
3) 69.0ms => 26.9ms bzrlib.directory_services
I would say the relative values are still about the same. Just that the
*total* time is cut in half. Some of the specific "this is worse than that"
also changes, but only slightly.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIxuumJdeBCYSNAAMRAvjGAJ4rbRJTnM3dw24y+KRTVXy3ngUvVgCfVAq/
8WFPtTzLF8w54SNs6xStCeg=
=eosP
-----END PGP SIGNATURE-----
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: imports_no_plugins.txt
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20080909/b7a28321/attachment.txt
More information about the bazaar
mailing list