是否有任何工具或好的技术来找出iPhone应用程序中的性能瓶颈所在? [英] Are there any tools or good techniques to find out where the performance bottlenecks are in an iPhone application?

查看:50
本文介绍了是否有任何工具或好的技术来找出iPhone应用程序中的性能瓶颈所在?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序完成了一半。性能不是很好,我想知道瓶颈在哪里。尽管我可以继续注释掉可疑的代码行,但我想知道是否有任何工具可以告诉我哪种方法很酷花费了多长时间以及接下来发生了什么。堆栈跟踪并不是真的有用。

I have an app that's half way done. The performance is not really good, and I wonder where the bottlenecks are. Although I can go ahead and start commenting out suspected lines of code, I wonder if there are any tools that would tell me which method cool took how long and what happened next. The stack trace isn't really that helpful.

我有一个奇怪的想法,将堆栈跟踪转换为GraphViz图形,以便直观地查看整个图片。我知道IBM的一些人做了类似的事情,生成了堆栈跟踪的可视化图形,这非常令人印象深刻且有意义。在我重新发明轮子之前:是否有一些好的工具或技术可以帮助发现iPhone OS上的性能瓶颈?

I had a weird idea to convert the stack trace into an GraphViz graph, to see visually the whole picture. I know some guys at IBM did something similar that generated an visual graph of the stack trace, which was very impressive and meaningful. Before I reinvent the wheel: Is there some good tool or technique that helps finding performance bottlenecks on iPhone OS?

推荐答案

正如肯尼斯所说,仪器,是可可应用程序性能优化的宝贵工具。可以在此处(或在您的Xcode中)找到其用户指南文档)。 Xcode调试工具的一大优点是它们可以在设备上执行的应用程序上运行,因此您可以使用Instruments在实际硬件上对应用程序进行性能分析。

As Kenneth said, Instruments in an invaluable tool for performance optimization of a Cocoa application. Its user guide can be found here (or in your Xcode documentation). One of the great things about the Xcode debugging tools is that they can be run against an application executing on the device, so you can use Instruments to do profiling of your application on the actual hardware.

使用仪器时,我发现CPU采样器工具可以很好地细分我的应用程序在哪里花费的时间最多。例如,我假设自己是一个慢速的SQLite查询,并且在运行Instruments时发现我的SQLite交互实际上是由于一些浪费的字符串处理例程而引起的。

When using Instruments, I've found that the CPU Sampler tool can give a very good breakdown of where my application is spending the most time. For example, I had what I assumed to be a slow SQLite query and was gearing up to optimize all my SQLite interactions when I ran Instruments and found it to actually be due to some wasteful string processing routines.

您也可以使用 Shark 进行分析,尽管它不是

You can also use Shark for profiling, although it's not as easy to use.

您可能还对以下问题的答案感兴趣:

You may also be interested in the answers to these questions:

这篇关于是否有任何工具或好的技术来找出iPhone应用程序中的性能瓶颈所在?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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