Proposal
Optimize reportActions loading performance for large sets
Problem
When users have chat histories with 1,000+ report actions, the useLoadReportActions hook takes over 3000ms to process the data, which causes chat interfaces to freeze and prevents users from efficiently navigating their conversations.
Solution
Optimize useLoadReportActions hook in the following way to reduce its’ processing time:
Replace the current O(n²) Array.map + Array.includes pattern with O(1) Set-based lookups by converting allReportActionIDs into a Set for instant membership testing.
Eliminate redundant iterations by processing all report actions in a single pass, tracking first and last occurrences for both current report and transaction thread simultaneously.
Thread: https://expensify.slack.com/archives/C05LX9D6E07/p1748012519024809
Improvements:
CMD+K showing modal with a 4x CPU throttling.
Before: 4sec
After: 1sec
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~021928073157688472631
- Upwork Job ID: 1928073157688472631
- Last Price Increase: 2025-05-29
Issue Owner
Current Issue Owner: @gedu
Proposal
Optimize reportActions loading performance for large sets
Problem
When users have chat histories with 1,000+ report actions, the useLoadReportActions hook takes over 3000ms to process the data, which causes chat interfaces to freeze and prevents users from efficiently navigating their conversations.
Solution
Optimize useLoadReportActions hook in the following way to reduce its’ processing time:
Replace the current O(n²) Array.map + Array.includes pattern with O(1) Set-based lookups by converting allReportActionIDs into a Set for instant membership testing.
Eliminate redundant iterations by processing all report actions in a single pass, tracking first and last occurrences for both current report and transaction thread simultaneously.
Thread: https://expensify.slack.com/archives/C05LX9D6E07/p1748012519024809
Improvements:
CMD+K showing modal with a 4x CPU throttling.
Before: 4sec
After: 1sec
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @gedu