RFC: startup time - again

Andrew Bennetts andrew at canonical.com
Wed Sep 10 00:36:37 BST 2008

John Arbash Meinel wrote:
> 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've used --profile-imports extensively to help my faster-startup branch :)

> 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.)

(I just approved your patch to use time.clock on win32.)

> 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'

My faster-imports branch does various things that greatly improves many of
these, at least for the “bzr rocks” and “bzr st” cases.


More information about the bazaar mailing list