Search code examples
androidcachingmemoryheap-memory

Is cache as efficient as VM/heap?


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?


Solution

  • 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.