[xml] xpath evaluation timeout


We sometimes run into the situation where a pretty expensive xpath (e.g. .//table//td[ class]) is run on a 
big document (~ 9M) and it takes very very long. In fact we never see it finish.

I did some digging and found that it is spending very long time on xmlXPathNodeSetMergeAndClear. So I went 
ahead and added a timeout to the function. It seems to be working well and no memory leak is observed.

I wonder if this is the right place to solve the problem and if there is anything I missed.

Attachment: xpath-timeout.diff
Description: Binary data


Zhigang Chen


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]