pageSize

val pageSize: Int = 10

Defines the number of items loaded at once from the PagingSource.

Should be several times the number of visible items onscreen.

Configuring your page size depends on how your data is being loaded and used. Smaller page sizes improve memory usage, latency, and avoid GC churn. Larger pages generally improve loading throughput, to a point (avoid loading more than 2MB from SQLite at once, since it incurs extra cost).

If you're loading data for very large, social-media style cards that take up most of a screen, and your database isn't a bottleneck, 10-20 may make sense. If you're displaying dozens of items in a tiled grid, which can present items during a scroll much more quickly, consider closer to 100.

Note: pageSize is used to inform PagingSource.LoadParams.loadSize, but is not enforced. A PagingSource may completely ignore this value and still return a valid PagingSource.LoadResult.Page.