我的 iPhone 应用程序加载速度比其他类似应用程序慢
我有一个基于位置的社交网络应用程序。 但它的加载速度比其他类似的应用程序慢得多。 加载照片时速度确实变慢。 如果我在我的应用程序的聊天窗口中发送一张照片,然后在其他类似应用程序中发送同一张照片,我的应用程序需要花费 10 倍的时间。 但我不知道为什么
I have a location based social networking app.
But it loads a lot slower than other similar apps.
It really slows down when loading photos.
If I send a photo in a chat window on my app and then the same photo in other similar apps My app takes 10 times longer.
But I do not know why
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果不具体了解您的应用程序的用途,我们无法提供具体的答案。幸运的是,您实际上并不需要我们告诉您应用程序速度缓慢的原因;您只需要学习如何自己弄清楚您的应用程序在做什么。
加速应用程序的第一步应该是使用 Instruments 分析应用程序。构建您的应用程序以进行分析,并使用 Time Profiler 工具在 Instruments 中运行它。花一些时间练习应用程序中您想要改进的部分,然后查看结果。您将能够查看您的应用花费时间的详细信息。这应该可以帮助您了解应用程序正在做什么,并且可以帮助您制定加速代码的策略。从本质上讲,您需要找到方法来减少应用程序花费最多时间的事情。这可能意味着缓存结果而不是重新计算或重新获取它们。这可能意味着推迟一些任务直到用户真正需要它们。或者它可能意味着其他东西。除非您了解所有时间都去哪儿了,否则您不会知道。
请务必保存第一个分析会话的结果。进行一些您认为会提高性能的更改后,重复相同的测试并将结果与第一个结果进行比较。这应该可以帮助您确认您所做的更改确实会按照您认为的方式影响性能。
对您关心的每个区域重复此过程。
10 倍速度差应该很容易检测到。您的竞争对手可能花费大量时间分析他们的应用程序以提高性能,因此即使您进行了所有能想到的改进,您也可能无法在速度上与他们匹敌,但您应该仍然能够找到一些显着提高性能的方法。
There's no way we can provide a specific answer without knowing specifically what your app does. Fortunately, you don't really need us to tell you why your app is slow; you only need to learn how to figure out for yourself what your app is doing.
Your first step in speeding up your app should be to profile the app using Instruments. Build your app for profiling and run it in Instruments using the Time Profiler tool. Spend some time exercising the part of your app that you want to improve, and then look at the results. You'll be able to see a breakdown of where your app spent time. This should help you understand what your app is doing, and that may help you devise a strategy for speeding up the code. Essentially, you'll want to find ways to do a lot less of whatever the app is spending the most time on. That might mean caching results instead of recomputing or refetching them. It might mean deferring some tasks until the user actually needs them. Or it might mean something else. You won't know until you understand where all that time is going.
Be sure to save the results of that first profiling session. After you make some changes that you think will improve performance, repeat the same test and compare the results to your first results. This should help you confirm that the changes you made really do impact the performance in the way that you thought they would.
Repeat the process for each area that you're concerned about.
A 10x speed differential should be pretty easy to detect. It may be that your competitors spent a lot of time profiling their apps to improve performance, so you may not match them in speed even after you've made all the improvements you can think of, but you should still be able to find some ways to increase performance significantly.