i have a performance Problem, if i load an JPG (and yes i can't provide any PNG File Format in the App) Image from the Disk with [UIImage imageWithContentsOfFile: ]
, store the UIImage in a global NSCache and use the Cached Image in [UITableViewCell drawRect: ]
. This approach is much slower than user [UIImage imagedNamed:]
.
If have analyzed the performance with the Instruments "Time Profile" and as you can see in the first picture the JPEG is always decode in the [DBArtistTableViewCell drawRect:]
.
In the second picture with the [UIImage imageNamed:]
solution the JPG will not decompressed.
NSCache
+ UIImage
Solution:
[UIImage imageNamed]
Solution
The short question is: Why is the UIImage
+ NSCache
solution slower than the [UIImage imageNamed:]
solution and what is the magic with [UIImage imageNamed:]
Method (yes i know the caching, but what is the rest of the magic) ?
Thx for Helping.