获得徽章 0
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇沸点
#iOS知识小集#「 获取UIImage时的时间差异对比 」
对比2组数据,数据由iPhoneX模拟器采集,下面这两组数据不同操作系统可能数据有所差别。整体来说从aseet中获取图片性能更优,在不同设备下 [UIImage imageNamed:inBundle:compatibleWithTraitCollection:] 获取图片可能优于 [UIImage imageNamed:]。希望对你有所启发。知识小集上次发布了一个这方面的文章,可以参考一下。
其它设备采集数据来源于 OPrior to iOS 9, loading images from your b...
t.cn。如图1
「 1、从 bundle 中获取图 」
使用imageNamed:获取图,耗时为 81ms; 如图2
「 2、从 asset 中获取图,把上面代码的图片移到asset中 」
a、采用 imageNamed:从asset中获取图片,耗时 3ms:
imageNamed: image:<UIImage: 0x60000012a0d0>, {750, 750}, time=3
b、采用 imageNamed:inBundle:compatibleWithTraitCollection:从asset中获取图片,耗时 13ms:
inBundle: image= <UIImage: 0x6000038bd960>, {750, 750}, time = 13
对比2组数据,数据由iPhoneX模拟器采集,下面这两组数据不同操作系统可能数据有所差别。整体来说从aseet中获取图片性能更优,在不同设备下 [UIImage imageNamed:inBundle:compatibleWithTraitCollection:] 获取图片可能优于 [UIImage imageNamed:]。希望对你有所启发。知识小集上次发布了一个这方面的文章,可以参考一下。
其它设备采集数据来源于 OPrior to iOS 9, loading images from your b...
「 1、从 bundle 中获取图 」
使用imageNamed:获取图,耗时为 81ms; 如图2
「 2、从 asset 中获取图,把上面代码的图片移到asset中 」
a、采用 imageNamed:从asset中获取图片,耗时 3ms:
imageNamed: image:<UIImage: 0x60000012a0d0>, {750, 750}, time=3
b、采用 imageNamed:inBundle:compatibleWithTraitCollection:从asset中获取图片,耗时 13ms:
inBundle: image= <UIImage: 0x6000038bd960>, {750, 750}, time = 13
展开
评论
1
赞了这篇文章
赞了这篇文章
赞了这篇文章
赞了这篇文章
OpenGL