Comment 3 for bug 1974105

Revision history for this message
Leonard Richardson (leonardr) wrote : Re: slow performance within Tag.index(child)

Luke, thanks for filing this ticket and providing a proposed implementation. I'm going to take a serious look at this when I have time, but historically I've been reluctant to consider solutions that involve caching tree state. Because of the wide variety of ways Beautiful Soup trees are created, and the many things people do to them after they're created, it's difficult to prove that the cache is always invalidated when it should be.

Like I said, I'll look at this implementation on its own terms, but that's where I'm coming from in general.

If you can provide your original test document and test code it would help me understand the problem you're trying to solve. Based on what you say, I think the fundamental problem is that the unwrap() implementation is inefficient because it's implemented as a series of calls to insert().