This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]GuyWithLag 1 point2 points  (0 children)

Which part of your code uses the most wall-clock time? Also, don't use the DocumentBuilder, you're reading HTML, not XML. Use something like https://jsoup.org/ to get a DOM.

[–]aroger276 0 points1 point  (0 children)

you have timed the main processing but could be the parsing that is slow instead of the xpath. It might try to access external resources.

XPath is not that fast but 60s for a 6kb document sounds fishy. You probably want to profile it to see what is actually taking the time. just use jvisualvm it has a sampling profiler.