On Wednesday, 2 June 2021 at 10:17:52 UTC, drug wrote:
Usually 1 million of items aren't visible at once. Also there
is opinion that total redrawing can be more efficient than
caching because of making a decision what to cache and what not
can be very complex.
Depends on the application.
My view on the GPU has changed a bit as some applications may use
the GPU for computing application data, also pushing the GPU too
hard will make it hot and fans start running (making users
wonder what the app is doing).
Say, if I used an accounting program and it caused the fan to
spin, then I would be annoyed. :-D
To estimate the height you need to have height of every
elements, you can't dynamically create elements in that case. I
create some wrapper over data set that stores height of
elements. It's much cheaper and faster than creating a widget
per item - that is a real advantage over retained gui. And user
has access to that info - that is advantage over immediate gui.
But yes, there are tasks that can/should be performed by
dynamically created elements.
Varying heights can be tricky, so just computing the heights in a
wrapper seems reasonable.
Another approach is to use an estimate that is updated as you
bring in more items, but that is real work (for the programmer).