开发者

iPhone Profiling and optimization

So I recently made some changes to one of my tableviews and I no开发者_运维百科ticed that when the cells are being reloaded (coming back onto the screen one way or another) there is like a quarter to half second lag. I decided I'd use xcode 4's nice built in profiler. What I found is that during these spikes, most of the time running is being spent in gzopen and png_read_filter_row

I traced these functions in the call tree viwer all the way back to main, and it is never in any of my real code. The only questionable thing I am doing is small image files (1 per cell) each time cellForRowAtIndexPath is called.

I guess my question is this:

  1. Is the file i/o that slow so that I should switch to caching these images in memory rather than on the file system?
  2. How can I figure out what exactly it is thats slowing down my application so much using the profiling tool?

Thanks!


  1. Can you load the images asynchronously - show a spinner where the image goes and fire off a background thread to display the image. This is a common solution to the "thumbnail image in a table row" problem.

  2. I think you already have used the profiling tool to track down the problem: loading images. Admittedly, I am no expert on the profiler, but I think you know what you need to know. So implement your table a) without images b) with images loaded from files c) with images loaded asynchrously and stick with the fastest one. (I'm not trying to be glib, I'm just highly prejudiced toward getting the code out the door.)

Hope this helps. -Mike

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜