Search: debounce search-as-you-type to reduce per-keystroke work
The library search bars (Songs, Artists, Albums list/grid and the add-to-playlist pickers) ran a Core Data fetch plus a table/collection reload on every keystroke, which stuttered on large libraries. The global search additionally fired a network request and a background fetch per keystroke.
Add a small SearchDebouncer (200 ms, trailing edge) shared by all search-as-you-type screens. Clearing the field runs immediately so the full list / search history reappears without delay; a new keystroke cancels the pending work item.
Measured on a ~50k-song library, typing a 6-character query: local Core Data searches 6 -> 1, API search calls 6 -> 1.
合并状态:未合并 1 条评论