简体   繁体   English

iOS - 应用程序首次启动时发布速度非常慢

[英]iOS - App Launch Very Slow At First Launch

在此输入图像描述

The BSW SMAR... App is what I am talking about. BSW SMAR ... App就是我所说的。 After installation directly from Xcode. 直接从Xcode安装后。 This app launches very slow. 这个应用程序启动非常慢。 It takes about 3-5 seconds before the launch screen would appear. 在启动屏幕出现之前大约需要3-5秒。 But only the first launch is that slow. 但只有第一次发射才是那么缓慢。 After that the launch speed becomes normal again. 之后,发射速度再次恢复正常。 What could possibly be the cause of the problem? 可能是问题的原因是什么?

--- Some Screenshots From Time Profiler --- ---来自Time Profiler的一些截图---

This is what I got from the first launch of the app. 这是我第一次推出应用程序时得到的。

在此输入图像描述

I focused on the part stating the time took by the app for initialization. 我专注于说明应用程序初始化所花费的时间。 It says there that initializing the app's address spaces and dynamic linking of frameworks took a lot of time. 它说,初始化应用程序的地址空间和框架的动态链接花费了大量时间。 When I click on the arrow next to the selection of the first item. 当我单击第一个项目选择旁边的箭头时。 This is what I saw. 这就是我所看到的。

在此输入图像描述

It seems that the time it took for the app to do other tasks is not listed in here. 这里似乎没有列出应用程序执行其他任务所花费的时间。 I am talking about the long time tasks because base on what I see the sum of the time of the listed task above didn't even reach 1 sec. 我说的是长时间的任务,因为基于我所看到的上面列出的任务的时间总和甚至没有达到1秒。 So, there must be other lengthy task that are not listed or can't be listed at all(Well, that's what I thought). 因此,必须有其他冗长的任务未列出或根本不能列出(嗯,这就是我的想法)。

If linking the frameworks would took a long time then that would be acceptable. 如果链接框架需要很长时间,那么这是可以接受的。 But I don't think I have that much of frameworks for the app to take a long time to link. 但我认为我没有那么多的应用程序框架需要很长时间才能链接。 On the otherhand, if the longer time are wasted in initializing the address spaces then I would expect that the app would take long time launch in EVERY launches in the future, not just the first. 另一方面,如果在初始化地址空间时浪费的时间较长,那么我预计应用程序将在未来的每次发布中花费很长时间,而不仅仅是第一次。

Run the code, for the first time as you said. 如你所说,第一次运行代码。

Dont forget to enable Time-Profiler . 别忘了启用Time-Profiler

In track graph shown in top position will let you know the time in which getting more time to execute a single method. 在顶部位置显示的轨迹图中,将告诉您获得更多时间执行单个方法的时间。
Heaviest Stack Trace (Extended detail pane) : At the right bottom portion, Let you know which method is getting executed in that timestamp. 最重要的堆栈跟踪(扩展详细信息窗格):在右下角,让您知道在该时间戳中执行的方法。 在此输入图像描述

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

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