这两行占用了我的应用程序整个加载时间的 40% 和 42%(共 84%)。我用Instruments测试了它。
NSData *storeImageData = [NSData dataWithContentsOfURL:storeImageURL]; //40% whole load time
UIImage *storeImage = [UIImage imageWithData:storeImageData]; //42% whole load time
是否有另一种/更好的方法来加快我的应用程序的加载时间?这两行和更多的代码都在一个循环中,将循环大约 500 次。
请注意
,将“http://”添加到通常的“www.blah.net”后,它开始变慢。有谁知道为什么 URL 中的 7 个字符(大约 30-50 个)会大大降低加载时间。在我改变它之前,它花了 3 秒钟。现在是 37 秒。