Skip to the page

Performance: measure, then fix · mid

Images: decoded size, caching and expo-image

An image costs memory by its decoded pixels (width × height × 4 bytes), not by its file size, so you request display-sized images from a CDN, show thumbnails in lists, and use a caching image component such as expo-image with placeholders and recycling keys.

The notes

What you must know

  • Decoded size = width × height × 4 bytes. A 4000×3000 photo takes about 46 MB of memory even if the JPEG file is 2 MB.
  • Ask the CDN for the size you actually display (times the pixel ratio), in WebP or AVIF. resizeMode / contentFit only change how the bitmap is drawn, not how big it is.
  • expo-image: SDWebImage on iOS and Glide on Android; cachePolicy (default "disk"), placeholder with blurhash or thumbhash, transition, priority, recyclingKey for recycled list cells, Image.prefetch.
  • react-native-fast-image was unmaintained for years; the RN docs mention Dream11's fork @d11/react-native-fast-image, and the original was revived in Oct 2026 (v10, New Architecture only).
  • Prefetch only the next page; cap caches; clear the memory cache on memory warnings.
  • Animate images with transform: scale, not width/height, because layout changes are expensive.

The red pen

Common traps: mistake → fix

  • Mistake: "resizeMode cover makes a big image cheap"

    Fix: the full bitmap is still decoded.

  • Mistake: "The file size is the memory cost"

    Fix: memory is decoded pixels.

  • Mistake: "Prefetch the whole feed"

    Fix: wastes mobile data and fills the cache.

Easy to hard

Questions interviewers ask, easy to hard

  1. How much memory does one 4000×3000 image take when decoded?
  2. Optimize a product grid of large photos.
  3. Which caching library do you use and why?
  4. A list briefly shows the wrong image in a row. Why?

Explain it out loud

Explain it out loud to an AI interviewer that follows up, and see where your answer is thin.

Practise by voice

Your first interview is free

Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.

Start your free interview