简体   繁体   English

Android apk大小会影响应用性能吗?

[英]Does Android apk size affect app performance?

I use an OCR library inside my app. 我在我的应用程序中使用OCR库。 The "OCR.so" library is loaded only if the user selects OCR option. 仅当用户选择OCR选项时才加载“OCR.so”库。 This OCR library has increased my apk file size from 700KB to 4.7MB. 此OCR库已将我的apk文件大小从700KB增加到4.7MB。 I would like to know whether this increase in apk size will have an impact on the performance of the app even for cases when the user is not selecting the OCR option? 我想知道即使在用户没有选择OCR选项的情况下,apk大小的增加是否会对应用程序的性能产生影响?

In other words, the apk size is 4.7MB, but if I am not calling System.loadLibrary("OCR"), will the apk size have any impact on the performance of the app due to memory constraints? 换句话说,apk大小是4.7MB,但如果我不调用System.loadLibrary(“OCR”),由于内存限制,apk大小会对应用程序的性能产生任何影响吗?

The OS does not allocate memory depending on the apk file size. 操作系统不会根据apk文件大小分配内存。 APK file is nothing but a zip file which is extracted into a folder during installation. APK文件只是一个zip文件,在安装过程中将其解压缩到一个文件夹中。 When an App is opened, the OS loads the first executable file which in your case would be the main native library. 打开应用程序时,操作系统会加载第一个可执行文件,在您的情况下,该文件将成为主要的本机库。 Then which the native library loads other libraries, the other library files also get loaded. 然后本机库加载其他库,其他库文件也被加载。 Otherwise, if you don't call system.loadlibrary, the OS won't load it to memory. 否则,如果不调用system.loadlibrary,操作系统将不会将其加载到内存中。

There will definitely be a latency. 肯定会有延迟。 Let me explain it in simple words - memory allocation. 让我用简单的话来解释 - 内存分配。 When an app is started, OS evaluates, optimizes and allocates memory to process, higher the size more the constraints and more the latency for startup. 启动应用程序时,操作系统会评估,优化和分配要处理的内存,更大的约束和更多的启动延迟。

Now, during the app lifetime after startup, depends on a lot of factors. 现在,在启动后的应用程序生命周期中,取决于很多因素。 But in short lower the apk better it is. 但总之,它更好地降低了apk。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM