skiptools / skip-ui

SwiftUI for Android
https://skip.tools
GNU Lesser General Public License v3.0
116 stars 11 forks source link

Picker has bad performance with long lists #48

Open aabewhite opened 1 week ago

aabewhite commented 1 week ago

Our Picker implementation is very slow when there is a long list of options. It eagerly evaluates all content views to look for the selected tag value.

It should be possible to figure out if the content is a ForEach that uses untagged views, and in that case we could feed the selected value into the ForEach's content block in order to output the selected view rather than collect all the views up front.

We could then modify the .navigation picker style target view to use the ForEach too rather than unrolling it.

marcprux commented 5 days ago

The improvements from https://github.com/skiptools/skip-ui/pull/50 look great. Running the "Long values" sample from https://github.com/skiptools/skipapp-showcase/pull/5 on my Pixel 6 does exhibit some stuttering when fling-scrolling (in a way that simple list content does not), but it is still a huge improvement over the previous performance.

https://github.com/user-attachments/assets/9cd597c8-b940-416e-9df3-8cc84b1e6d4a