Repository navigation
[No QA] perf: Build the room participant set once per mention lookup - #107366
roryabraham merged 6 commits into
Conversation
|
Before and after recordings: Chrome, local development build, 4x CPU slowdown, the workspace Before ( A-p2000-t4-chatpane.mp4After (this PR): the suggestion list appears about 0.6 s after B-p2000-t4-chatpane.mp4 |
|
Side-by-side comparison for accurate comparison. side-by-side-p2000-t4.mp4 |
|
@lorretheboy Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / Safari |
|
Reviewing... |
|
@MelvinBot review |
|
🤖 Web test steps verification results: Testing was blocked by unavailable fixtures on dev NewDot web. No regression was confirmed.
Code review: No actionable correctness issues found. The participant Set is built outside the per-contact callback, and the helper preserves owner, manager, and hidden-participant membership. Local validation: 1,771 unit tests passed, plus all 5 benchmark scenarios. Benchmark timings are not treated as validated performance measurements because plain Jest emitted a Reassure configuration warning. Browser behavior and the reported speedup remain independently unverified. |
|
@KJ21-ENG I think we don't need QA for this PR as it is purely util function refactoring while we have already included sufficient test/perf test. Please add [No QA] prefix in PR title |
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 roryabraham has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
🚀 Deployed to staging by https://github.com/roryabraham in version: 9.5.53-0 🚀
|
|
No help site update needed — this PR only optimizes mention suggestion performance without changing suggestions, their order, or the user workflow, so existing guidance remains accurate. |
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.5.53-3 🚀
Bundle Size Analysis (Sentry): |

Explanation of Change
The composer ranks room participants first in the
@mention suggestions. To do that,getUserMentionOptionscalledisReportParticipantonce for every personal detail, and each call built a new array fromreport.participantsand searched it. One suggestion refresh therefore cost (personal details) × (room participants), on every key typed in a mention.This PR builds the participant set once per refresh with a new
getReportParticipantAccountIDSethelper (participants, owner and manager) and checks each personal detail against it.isReportParticipantuses the same helper, so the rule stays in one place. The suggestions and their order do not change.Jest benchmark (
tests/perf-local/SuggestionMention.perf-local.ts): renders the realSuggestionMentionfor a workspace room and times one@allookup. GitHub Actions runner,mainand this PR alternated, median of 3 runs (each run measures the lookup 10 times):Chrome, local development build, 4x CPU slowdown, a workspace
#adminsroom, 17,000 personal details and the extra room participants added on the client only. Time from typing@to the suggestion list showing,mainand this PR alternated, median of 3 runs:In the CPU profile at 2,000 participants,
isReportParticipantaccounts for 12.5 s across the three keys typed (@,a,l) onmain, and the new check for 2 ms with this PR.Fixed Issues
$ #107437
PROPOSAL: #107437
Tests
@in the composer, then one or two letters that match several people.@and a letter, and verify that suggestions appear in alphabetical order.Offline tests
Same as tests. Mention suggestions are built from data already on the device.
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
Same as tests.
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectionAvatar, I verified the components usingAvatarare working as expected)npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso the design team can review the changes.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Workspace room: room participants first, then workspace members, then everyone else; selecting a suggestion inserts the mention
01-room-mention.mp4
Group chat: group members first
02-group-mention.mp4
1:1 chat: alphabetical order
03-1on1-mention.mp4
Offline: same suggestions from local data
04-room-offline.mp4
Android: mWeb Chrome
Workspace room: room participants first, then workspace members, then everyone else; selecting a suggestion inserts the mention
01-room-mention.mp4
Group chat: group members first
02-group-mention.mp4
Offline: same suggestions from local data
03-room-offline.mp4
iOS: Native
Workspace room: room participants first, then workspace members, then everyone else; selecting a suggestion inserts the mention
01-room-mention.mp4
Group chat: group members first
02-group-mention.mp4
1:1 chat: alphabetical order
03-1on1-mention.mp4
Offline: same suggestions from local data
04-room-offline.mp4
iOS: mWeb Safari
Workspace room: room participants first, then workspace members, then everyone else; selecting a suggestion inserts the mention
01-room-mention.mp4
Group chat: group members first
02-group-mention.mp4
MacOS: Chrome / Safari
Chrome, local development build, 4x CPU slowdown, the workspace
#adminsroom with 17,000 personal details and 2,000 room participants. Each clip types@,aandlin the composer.Before (
main): the suggestion list appears about 5 s after@is typed.A-p2000-t4-chatpane.mp4
After (this PR): the suggestion list appears about 0.6 s after
@is typed.B-p2000-t4-chatpane.mp4
After merging the latest
main: workspace room (weighted order and selecting a suggestion), 1:1 chat (alphabetical order) and the same room offline.desktop-room-dm-offline.mp4