做外部库让应用程序慢? [英] Do external libraries make apps slower?

查看:120
本文介绍了做外部库让应用程序慢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我建立了从网页刮信息的应用程序。要做到这一点我选择,因为它是如此简单易用使用名为 Jsoup 一个HTML刮刀。 Jsoup也依赖于Apache的百科全书郎libray。 (他们一起构成了总共385KB的)。
所以Jsoup将被用来下载页面,解析它。

I am building an app that scrapes information from web pages. To do that I have chosen to use an html scraper called Jsoup because it's so simple to use. Jsoup is also dependent on Apache Commons Lang libray. (Together they make up a total of 385kB ). So Jsoup will be used to Download the page and parse it.

我的问题是,如果使用这些简化库,而不是使用内置库机器人,将会使我的应用程序慢? (在下载数据和解析方面)。

My question is if the use of these simplifying libraries, instead of using Androids built-in libraries, will make my app slower? (in terms of downloading data and parsing).

我在想,内部图书馆将针对Android进行优化。

I was thinking that the internal libraries would be optimized for Android.

推荐答案

如果问题是,将外部库固有让我的应用程序比我写的一样code自己慢?,答案通常是, 是的,但不是很多。

If the question is, "Will external libraries INHERENTLY make my app slower than if I wrote the same code myself?", the answer is generally, "Yes, but not very much."

这将需要JVM的一些时间来加载外部库。这可能是因为图书馆有功能或不使用,并加载这些或阅读他们过去还需要一段时间的功能。但在大多数情况下,这种差异将是微不足道的,我就不会担心它,除非你是在一个高度受限的环境中。

It will take the JVM some time to load an external library. It's likely that the library has functions or features that you aren't using, and loading these or reading past them will take some time. But in most cases this difference will be trivial, and I wouldn't worry about it unless you are in a highly constrained environment.

如果你的意思是,我可以写code,会做同样的功能不是外部库快?,得到的回答是,几乎可以肯定是的,但它是值得你的时间?

If what you mean is, "Can I write code that will do the same function faster than an external library?", the answer is, "Almost certainly yes, but is it worth your time?"

赔率是你使用任何外部库都会有各种各样的,你并不需要,但包括以适应别人的需求特点。该库的作者不知道到底他们有一个普遍的方式来优化每个用户达等什么。所以,如果你写你自己的code,你可以把你需要的东西,仅此而已,并进行优化,以你是什么上来的。

The odds are that any external library you use will have all sorts of features that you don't need but are included to accomodate the needs of others. The authors of the library don't know exactly what every user is up to so they have to optimize in a general way. So if you wrote your own code, you could make it do exactly what you need and nothing more, and be optimized to exactly what you are up to.

是否值得你的具体情况的麻烦是个大问题。

Whether it's worth the trouble in your particular case is the big question.

这篇关于做外部库让应用程序慢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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