~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/index.py

Make GraphIndex.iter_entries do hash lookups rather than table scans.

Show diffs side-by-side

added added

removed removed

Lines of Context:
283
283
        keys = set(keys)
284
284
        if not keys:
285
285
            return
286
 
        for node in self.iter_all_entries():
287
 
            if not keys:
288
 
                return
289
 
            if node[0] in keys:
290
 
                yield node
291
 
                keys.remove(node[0])
 
286
        if self._nodes is None:
 
287
            self._buffer_all()
 
288
        keys = keys.intersection(self._nodes)
 
289
        if self.node_ref_lists:
 
290
            for key in keys:
 
291
                value, node_refs = self._nodes[key]
 
292
                yield key, value, node_refs
 
293
        else:
 
294
            for key in keys:
 
295
                yield key, self._nodes[key]
292
296
 
293
297
    def _signature(self):
294
298
        """The file signature for this index type."""