缓存与虚拟机/堆一样高效吗?
我是 BitmapFactory.decodeResource,然后缩放存储在 /res 中的 jpg 图像 (600x400),以便在画布上的动画中使用。由于位图在解码后直接使用,因此动画快速且美观。
从缓存或内部存储文件写入和读取这些位图是否会像解码后直接使用时一样快速有效?
换句话说,当从缓存或内部存储文件读取位图时,是否会再次解码?
缓存和内部存储文件是否具有与堆内存相同的 16-24MB 限制?
它们是同一件事吗?
I'm BitmapFactory.decodeResourcing and then scaling jpg images (600x400) stored in /res for use in an animation on the canvas. The animation is quick and beautiful because the bitmaps are used directly after decoding.
Would writing and reading these bitmaps from cache or from an internal storage file work as fast and efficiently as they do when used directly after decoding?
In other words, are bitmaps decoded again when read from cache or an internal storage file?
Do cache and internal storage files have the same 16-24MB limit that heap memory has?
Are they the same thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为从 /res 和内部存储文件夹读取是等效的。
不过,我不确定您所说的“缓存”指的是什么。如果您正在谈论将位图保留在内存中而不是对其进行解码,那么我认为这会快得多。
I think that reading from /res and an internal storage folder would be equivalent.
I'm not sure what you're referring to by "cache" however. If you're talking about keeping the bitmaps in memory instead of decoding it, then I would think that would be much faster.