[Tutor] ElementTree: finding a tag with specific attribute
kent37 at tds.net
Sat Sep 17 03:31:52 CEST 2005
Danny Yoo wrote:
>>If you look at the list, for a while the functions are being called 777
>>times. This is probably the number of start tags in the document. But
>>when you get to recursiveChildGenerator(), all of a sudden it is called
>>898655 times, over 1000 times for each call to _fetch()! This is a
>>staggering number of calls, it is called 8 times for every character in
> Hi Kent,
> This sounds like a beautiful torture test for BeautifulSoup.
> Kent, can you send me a copy of that test file too if that's ok? I might
> have some time to look into the performance problem.
Bernard, would you send a copy to Danny? It's not my data so I'd rather not forward it.
Danny, the file is not particularly large or difficult, it has a simple structure and nests about six levels deep. Maybe there's some O(n^2) nastiness somewhere in BeautifulSoup.
More information about the Tutor