3 ms·
> The Lazy UI components (stacks, grids) will _delay_ their initialization, however, nothing actually ever gets re-used. So if you're working with a layout simi
by ericmay 4y ago
> The Lazy UI components (stacks, grids) will _delay_ their initialization, however, nothing actually ever gets re-used. So if you're working with a layout similar to Netflix, every time you scroll left/right/up/down, new cells are being created and are loading more image data into memory.
What's the trade-off here for loading versus pre-loading? I guess if you are pre-loading all of that content is loaded into memory from the start, right? I'm guessing there's a performance advantage to have images pre-loaded, but then:
1. Are you doing that dynamically? How would you know what content to pre-load onto the device? My Netflix queue is different from others.
2. If you're loading a lot of content (like scrolling left/right to get new titles) maybe it makes sense to guess/decide what the next cells off the screen might be and load those up as the user scrolls versus loading them for sure, and what about the case where the user scrolls down/up but not left right? You wouldn't necessarily want to load all of that content unless you know the user is going to look at it? Also wondering how for Netfilx this would factor into their algorithms. If I "like" a show when I first load the app if they pre-load the cells then they'll have more compute to re-load all the cells to change their recommendations?
Curious about this.
- saagarjha 4y agoPreloading in this case is "rendering a cell before you scroll to it".
- ericmay 4y agoYes but presumably that cell has content fetched from a server right (title, actor names, title image which itself is dynamic based on Netflix A/B testing scheme, etc.)? Wouldn't it be faster to just get the content from the server ad hoc? I'm thinking you'd also potentially have a lot more network overhead if you preload the cells because then if a user doesn't scroll to one of these cells you've created them and they aren't used, and you've fetched server content too. How many cells would you create? I guess maybe Netflix has a default limit per category of titles they would display?