Rev 2630: Remove performance overhead of set intersection against dicts in index iteraction. in http://people.ubuntu.com/~robertc/baz2.0/index

Robert Collins robertc at robertcollins.net
Fri Jul 27 06:55:48 BST 2007


At http://people.ubuntu.com/~robertc/baz2.0/index

------------------------------------------------------------
revno: 2630
revision-id: robertc at robertcollins.net-20070727055546-yx9oibzlvdz733yf
parent: robertc at robertcollins.net-20070727054646-muk3ote4u3l91dea
committer: Robert Collins <robertc at robertcollins.net>
branch nick: index
timestamp: Fri 2007-07-27 15:55:46 +1000
message:
  Remove performance overhead of set intersection against dicts in index iteraction.
modified:
  bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
=== modified file 'bzrlib/index.py'
--- a/bzrlib/index.py	2007-07-27 05:46:46 +0000
+++ b/bzrlib/index.py	2007-07-27 05:55:46 +0000
@@ -255,6 +255,7 @@
                 self._nodes[key] = (value, tuple(node_refs))
             else:
                 self._nodes[key] = value
+        self._keys = set(self._nodes)
         if trailers != 1:
             # there must be one line - the empty trailer line.
             raise errors.BadIndexData(self)
@@ -302,7 +303,7 @@
             return
         if self._nodes is None:
             self._buffer_all()
-        keys = keys.intersection(self._nodes)
+        keys = keys.intersection(self._keys)
         if self.node_ref_lists:
             for key in keys:
                 value, node_refs = self._nodes[key]



More information about the bazaar-commits mailing list