feat(): LibraryViewModel performance improvements - #1693
Conversation
…wercased on creation rather than doing multiple operations. (Go from O(n log n) to O(n). Much nicer.
📝 WalkthroughWalkthrough
ChangesLibrary filtering pipeline
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant FilterRequest
participant LibraryViewModel
participant PaginationState
FilterRequest->>LibraryViewModel: start filtering
LibraryViewModel->>LibraryViewModel: cancel prior filter and page jobs
LibraryViewModel->>PaginationState: cache full filtered list
FilterRequest->>LibraryViewModel: change page
LibraryViewModel->>PaginationState: slice cached list and apply pagination
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
All reported issues were addressed across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…currently runnin jobs to avoid excessive retirevals.
… into feat/viewmodel-improvements
|
Encompassed by: #1721 But feel free to merge this as a smaller step to reduce that PR's size. |
Description
Overall, the UI should be vastly more responsive on initial and further retrievals for games going forward. This also means Carousel should be much more usable.
Recording
Type of Change
Checklist
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed.CONTRIBUTING.md.Summary by cubic
Speeds up
LibraryViewModelfiltering, sorting, and pagination to reduce CPU work and UI redraws. The library and carousel feel more responsive on first load and when paging; pagination now cancels stale work.applyPaginationinstead of re-filtering on page changes.pageJobandfilterJobwithensureActive(); cancel in-flight pagination on rebuild to avoid stale UI commits.sortNameper entry for cheaper comparisons.ConcurrentHashMap; batch installed-branch lookup withSteamService.getAllInstalledApps().GOG/Epic/Amazoncredentials once per run and reuse for filtering and badge counts.Written for commit 11187c0. Summary will update on new commits.
Summary by CodeRabbit