~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/btree_index.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2008-11-26 06:00:51 UTC
  • mfrom: (3847.2.3 builder_iter_entries)
  • Revision ID: pqm@pqm.ubuntu.com-20081126060051-cwcyil3w3ek8llsh
(jam) Make BTreeBuilder.iter_entries faster by using a smaller set
        for difference_update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
431
431
            efficient order for the index (keys iteration order in this case).
432
432
        """
433
433
        keys = set(keys)
 
434
        local_keys = keys.intersection(self._keys)
434
435
        if self.reference_lists:
435
 
            for key in keys.intersection(self._keys):
 
436
            for key in local_keys:
436
437
                node = self._nodes[key]
437
438
                yield self, key, node[1], node[0]
438
439
        else:
439
 
            for key in keys.intersection(self._keys):
 
440
            for key in local_keys:
440
441
                node = self._nodes[key]
441
442
                yield self, key, node[1]
442
 
        keys.difference_update(self._keys)
 
443
        # Find things that are in backing indices that have not been handled
 
444
        # yet.
 
445
        if not self._backing_indices:
 
446
            return # We won't find anything there either
 
447
        # Remove all of the keys that we found locally
 
448
        keys.difference_update(local_keys)
443
449
        for backing in self._backing_indices:
444
450
            if backing is None:
445
451
                continue