问题
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