Rev 5852: We don't need a second named parameter. in http://bazaar.launchpad.net/~jameinel/bzr/2.4-uncommit-faster
John Arbash Meinel
john at arbash-meinel.com
Tue May 10 15:15:52 UTC 2011
At http://bazaar.launchpad.net/~jameinel/bzr/2.4-uncommit-faster
------------------------------------------------------------
revno: 5852
revision-id: john at arbash-meinel.com-20110510151545-ifc1h4a5yc3pg0wu
parent: john at arbash-meinel.com-20110510150803-e1inbruqru2ob8o7
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.4-uncommit-faster
timestamp: Tue 2011-05-10 17:15:45 +0200
message:
We don't need a second named parameter.
.from_sequence is only called for each new dir (about 4k times), vs for
every file (70k times). So it isn't an expensive lookup.
The big thing is to just *use* StaticTuple, and make it not too
expensive to access it.
-------------- next part --------------
=== modified file 'bzrlib/dirstate.py'
--- a/bzrlib/dirstate.py 2011-05-10 15:08:03 +0000
+++ b/bzrlib/dirstate.py 2011-05-10 15:15:45 +0000
@@ -2626,16 +2626,15 @@
it's easier to sort after the fact.
"""
split_dirs = {}
- def _key(entry, _split_dirs=split_dirs, st=static_tuple.StaticTuple,
- as_st=static_tuple.StaticTuple.from_sequence):
+ def _key(entry, _split_dirs=split_dirs, _st=static_tuple.StaticTuple):
# sort by: directory parts, file name, file id
dirpath, fname, file_id = entry[0]
try:
split = _split_dirs[dirpath]
except KeyError:
- split = as_st(dirpath.split('/'))
+ split = _st.from_sequence(dirpath.split('/'))
_split_dirs[dirpath] = split
- return st(split, fname, file_id)
+ return _st(split, fname, file_id)
return sorted(entry_list, key=_key)
def set_state_from_inventory(self, new_inv):
More information about the bazaar-commits
mailing list