Contents

Home › Articles

Sizing a RecyclerView Adapter for Smooth Scrolling

By Rahul Mehta · Published · 4 min read

Close-up of a long vertical list of rows representing a scrolling RecyclerView.
Close-up of a long vertical list of rows representing a scrolling RecyclerView. · Foto: MasterTux / Pixabay

RecyclerView smoothness rarely comes down to one magic setting. It comes from the balance between how many view holders exist, how much work each bind does, and how often the adapter replaces its data. Get those three roughly right and most lists scroll at a steady frame rate even on modest hardware.

This article walks through the numbers that matter: pool sizes, item view type counts, DiffUtil payload sizes, and the millisecond budget you actually have per frame. The goal is a mental model you can apply to a real adapter instead of guesswork.

Know Your Frame Budget First

At 60Hz you have about 16.6ms per frame; at 120Hz that drops to roughly 8.3ms. Layout, measure and draw for the list compete with everything else on the main thread, so a realistic target for adapter binding is 1-3ms per item during fling. Anything that regularly crosses 5ms per bind will show as jank on mid-range devices even if it feels fine on your flagship test phone.

The practical takeaway: measure before you optimise. Use the Layout Inspector and a simple trace around onBindViewHolder to see how much of the frame your adapter consumes. If binds are under a millisecond, stop tuning the adapter and look elsewhere. If they are several milliseconds, no pool size will save you — the work itself has to shrink.

  • 60Hz: ~16.6ms per frame
  • 90Hz: ~11.1ms per frame
  • 120Hz: ~8.3ms per frame
  • Aim for 1-3ms of bind work per item

How Many View Holders Should Exist?

By default RecyclerView keeps a small pool of scrap views plus whatever is attached plus a view cache. For a single view type showing full-width rows, you typically only need enough holders to fill the screen plus a couple of buffer rows — on a phone that is usually 8-12 holders. Setting a large pool does not make scrolling faster; it just keeps more detached views in memory, each holding a full view tree.

The exception is lists with many view types or expensive view creation. If inflating a complex row takes several milliseconds, a slightly larger pool (for example screen-fill count multiplied by the number of common types) avoids repeated inflation during fast flings. Use RecyclerView.RecycledViewPool with setMaxRecycledViews per type rather than a blanket large pool.

  • Single view type: screen fill + 2-3 is usually enough
  • Many view types: raise per-type limits selectively
  • Expensive inflation: pre-inflate or cache layouts
  • Nested lists: share one pool via setRecycledViewPool
0.4Payload update0.8Simple text row2.5Image row, downsam9Image row, full de35Main-thread diff (
Approximate bind time per item by adapter pattern (ms) (ms)
Typical adapter costs and what to do about them
Adapter behaviourTypical costRisk levelSuggested fix
Main-thread DiffUtil, 500 items20-60ms per updateHighBackground diff via ListAdapter
Full rebind instead of payload2-5ms per visible rowMediumReturn payloads for partial changes
Many view types (10+)Extra inflation per flingMediumMerge similar types, per-type pool limits
Image decode during bind5-20ms spikesHighDownsample off the main thread
Listener creation in bindUnder 1ms but constantLowCreate once in onCreateViewHolder
Nested carousels, no shared poolVariable, often 10ms+HighShare RecycledViewPool, prefetch

Diffing Without Burning Frames

DiffUtil on the main thread is a common source of dropped frames when lists change. A diff over a few hundred items can take tens of milliseconds, which is multiple frames. Move the calculation to a background dispatcher and submit the result, or use ListAdapter which does the background diffing for you. That alone removes most of the stutter people attribute to 'slow adapters'.

Payloads are the next lever. If only a title changed, sending a full rebind of the row wastes time on image loading and layout. Implement getChangePayload and apply targeted updates in onBindViewHolder with the payloads list. For lists that update frequently — chat, feeds, live prices — payload-based updates can cut bind work by half or more compared with full rebinds.

  • Diff off the main thread
  • Use ListAdapter with a stable identity check
  • Return payloads for partial updates
  • Keep areItemsTheSame cheap; avoid string concatenation

Keep Binding Work Predictable

The most reliable performance win is making every bind do roughly the same amount of work. Conditional layout changes, visibility toggles that trigger remeasure, and dynamic text sizing all cost more than they appear to. Prefer a fixed row structure and switch content inside it rather than swapping layouts per item state.

Image loading deserves its own budget. Decoding and scaling on the main thread during bind will cause visible hitches; hand that to an image loader with a fixed target size so it can downsample before decoding. Also avoid setting listeners or creating objects inside onBindViewHolder when they can be created once in onCreateViewHolder.

  • Create listeners and formatters in onCreateViewHolder
  • Fixed row heights where possible
  • Downsample images to the exact target size
  • Avoid requestLayout during bind

Nested and Mixed Lists

Horizontal carousels inside vertical lists are the classic jank trap, because each inner RecyclerView keeps its own pool and inflates its own rows during the parent's bind. Share a pool between inner lists of the same type, or set an initial prefetch count so the inner list has items ready before it is attached and measured.

For mixed feeds — headers, cards, ads, footers — keep the number of distinct view types low. Each type adds inflate cost and pool bookkeeping. If two types differ only by a background or a single label, merge them into one type and vary the content. Fewer types means better recycling and fewer surprise allocations during fling.

  • Share one RecycledViewPool across carousels
  • Merge near-identical view types
  • Give inner lists a prefetch count
  • Avoid wrap_content heights on nested lists

Measuring the Result

Judge changes with numbers, not feel. Run a scripted fling over a few hundred items and record frame timing; look at the 90th and 99th percentile frame durations rather than the average, because averages hide the stutters users notice. Repeat on a low-end device or a throttled emulator profile.

Track bind duration separately from layout and draw. If binds are cheap and frames still drop, the problem is usually layout complexity or overdraw, not the adapter. That distinction saves hours of tuning the wrong layer. Keep a short checklist and re-run it whenever the row layout changes significantly.

  • Measure p90 and p99 frame times
  • Test on a slow device profile
  • Separate bind time from layout time
  • Re-measure after row layout changes
  • Target 1-3ms of bind work per item during fling
  • Pool size is about reuse, not speed; scale it per view type
  • Always diff off the main thread and send payloads
  • Measure p90 and p99 frame times on a slow device
Rahul Mehta · Mobile tooling writer
Specialises in setup guides, build tooling and performance checks for mobile projects. Regularly benchmarks lists, scrolling and startup behaviour to give readers concrete numbers.

Related articles

↑