Slowdowns

John Arbash Meinel john at arbash-meinel.com
Mon May 22 22:02:09 BST 2006


John Arbash Meinel wrote:
> I've been doing more profiling, and I've found a few of the big import
> slowdowns. Generally, these are the things that cost time when we are
> doing 'time bzr rocks', which is the most 'no-op' that we can get.
> 
> On my machine, with a stock bzr, it takes 343ms to run 'bzr rocks'.
> 
> These are the worst offenders. Note that the times listed here are to
> import that file (which includes the time to import other files, etc)
> 
> 20ms doctest (for iterablefile)
> 
> 31ms elementtree
> 34ms cElementTree

Well, it turns out that cElementTree also depends on copy(), so if we
don't import copy ourselves, it just gets imported later. Which means
that 'import cElementTree' then takes 70ms instead of just 34ms.

Now, after all of these changes, and delayed loading, and everything
else, where has it gotten me? All of these are run with --no-plugins,
using 10 loops, best of 3 runs.

	Plain bzr.dev	demandload()
bzr --no-aliases rocks
	329ms		 83ms
bzr rocks
	341ms		154ms

bzr --no-aliases root
	381ms		277ms
bzr root
	395ms		360ms

bzr --no-aliases status
	619ms		559ms
bzr status
	605ms		596ms

So there is an advantage. For simple commands, it can be a lot. But for
something like 'bzr status', we are better off fixing other things.

The code is still available at:
http://bzr.arbash-meinel.com/bzr/branches/demandload

Just as a reference, on this machine 'hg root' takes 253ms. So 'bzr
--no-aliases root' with all the demandload stuff is actually the same
speed. And 'hg status' takes 300ms, but it is on a tree with only half
the number of files.

I'll let other people decide if this is actually worth trying to get
into a mergeable state.

John
=:->


ps> This is an example timing run:
python -m timeit "import os; os.system('python ~/dev/bzr/bzr.dev/bzr
--no-plugins --no-aliases st')"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060522/a00a6482/attachment.pgp 


More information about the bazaar mailing list