iOS 9 [UIImage ImageNamed:] poor performance

Prior to iOS 9, loading images from your bundle using [UIImage imageNamed:] was quite fast, and appeared to be coming from a cache. Now on iOS 9, that same call is an order of magnitude slower. I noticed this because a variable height cell TableView of mine is performing poorly on iOS 9, and I tracked it down to the loading of some images during cell height calculations. UIImage imageNamed is now slow enough that it should not be called in preparations for TableView cells. My temporary workaround is to statically load the images I need once. Attached is a sample project used to get the following performance numbers:

iPhone 6 running iOS 8.4 0.042 seconds to load 4 images 100 times

iPhone 6 running iOS 9 GM 0.83 seconds to load 4 images 100 times


Interestingly, running this same test on an iPad2 has radically different results:

iPad 2 running iOS 8.4 0.11 seconds to load 4 images 100 times

iPad 2 running iOS 9 GM 0.13 seconds to load 4 images 100 times



So, for some reason, loading images on an iPhone 6 using UIImage imageNamed: is 8x slower than it is on a iPad 2!?


I logged bug 22218487 which was closed as a duplicate of 21825629 which is also closed with no further information. Looks like this problem still exists in iOS 9 GM. Does anyone have any further information on this issue (perhaps you were the submitter of 21825629) I would like to know what Apple said on the other bug.

Accepted Reply

Good news folks. Looks like this is fixed in iOS 9.1 I'm still seeing a small advanage in performace when calling [UIImage imageNamed:inBundle:compatibleWithTraitCollection:] which is surprising, but 9.1 is back to the fast cached performance that we had in iOS 8.4

Replies

Any news regarding this? The drop in performance is quite baffling

Good news folks. Looks like this is fixed in iOS 9.1 I'm still seeing a small advanage in performace when calling [UIImage imageNamed:inBundle:compatibleWithTraitCollection:] which is surprising, but 9.1 is back to the fast cached performance that we had in iOS 8.4

THanks for the update! I haven't had a chance to test 9.1 yet...