Red line in Instruments

一笑奈何 提交于 2019-12-24 04:24:09

问题


I'm programming on objective-c and testing my application in Instruments. I uploaded screenshots below. I don't understand red line on my code and what's wrong? Can you help me? Thanks.


回答1:


The 82.2% probably represents the amount of execution time that was detected when your program was executed under a statistical profiler. The IDE changes colors on lines to draw your attention to the ones that represent the largest CPU use in your program.

Often times, these can help you find the "hotspots" in your program that represent the places where your software could use the most improvement.

In this case, it is a system-provided API, so you can't do much to improve the speed of the function, but you can improve how you use the results. Do you call this function with the same path data more than once in your program? You could cache the UIImage that it returns and re-use the parsed image each time you need it rather than re-reading it every time.

If you execute this function once for every image you display, never calling it twice with the same arguments, it would be extremely difficult to improve upon it further.



来源:https://stackoverflow.com/questions/8876570/red-line-in-instruments

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!