[MERGE] Improvements for _iter_changes

John Arbash Meinel john at arbash-meinel.com
Fri May 18 10:47:20 BST 2007


The attached patch drops our "bzr status" and "bzr diff" time by approx 
2x or so on a 50,000 entry tree. (~2s versus ~4s).

In general, it is just a cleanup of some of the inner loops. By moving 
some functions to be local variables (rather than looking up in the 
global dict), and removing code paths that aren't necessary. 
(DirState.update_entry had some convenience code, but it isn't meant to 
be a convenience function)

It also works to move the common case as low in the stack as possible. 
So if a file/directory has not changed detect that as early as possible 
so you do a minimal amount of processing.

It also includes a real bug fix. Which is that we were comparing the 
st_size value for directories against our saved information. But we 
always only store '0' for directories. Which was causing us to consider 
the dirstate to be dirty after every 'bzr status'.

There is also a small change that on my Mac, the 
"sys.getfilesystemencoding()" was returning 'utf-8' rather than 'UTF-8', 
so I updated the '_walkdirs' check so that it can use the fast-path 
code, rather than the slower unicode-walking code.

We also don't need the "utf8_decode_or_None" call, because we know when 
we are returning None and when we are returning real paths.

John
=:->
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: dirstate_optim_2.patch
Url: https://lists.ubuntu.com/archives/bazaar/attachments/20070518/b47a9a47/attachment-0001.diff 


More information about the bazaar mailing list