What are some tips one can keep in mind to speed up jSoup? I am pretty new to using jSoup and any advice about things I should do, things I should avoid, etc. would be most appreciated.
I just want to know some general things so that I won't slow down my own software.
For example, what is faster:
doc.select("[class=foo]:eq(0)").first()
or
doc.select("[class=foo]").first()
or
doc.select("[class=foo]:lt(1)").first()
Stuff like that.
You may want to try this tip (taken from here ):
not great
for (Element link : links)
better
int i;
Element tempLink;
for (i=0;i<links.size();i++) {
tempLink = links.get(i);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.