Comment 1 for bug 1974105

Revision history for this message
Luke P (lkp80877984) wrote : Re: slow performance within Tag.index(child)

As a further optimization in replace_with - because you're swapping one for one, extract removes the removed item from the cache, insert adds the inserted item to the cache, the cache doesn't actually get any more stale.

```
        old_parent = self.parent
        my_index = self.parent.index(self)
+ last_stale = old_parent._contents_cache_stale
        self.extract()
        old_parent.insert(my_index, replace_with)
+ old_parent._contents_cache_stale = last_stale
        return self
```

Cheers,
Luke