什么是jSoup优化提示? [英] What are some jSoup optimization tips?

查看:172
本文介绍了什么是jSoup优化提示?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了加速jSoup,可以记住哪些提示?我很擅长使用jSoup和任何关于我应该做的事情的建议,我应该避免的事情等等。非常感谢。

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.

例如,更快的是:

doc.select("[class=foo]:eq(0)").first()

doc.select("[class=foo]").first()

doc.select("[class=foo]:lt(1)").first()

这样的东西。

推荐答案

您可能想尝试这个提示(取自其他):

You may want to try this tip (taken from here):

不太好

for (Element link : links)

更好

int i;
Element tempLink;
for (i=0;i<links.size();i++) {
   tempLink = links.get(i);
}

这篇关于什么是jSoup优化提示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆