You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2025-07-14] [$250] Improve the subscribeToKey efficiency in Onyx #64774
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Onyx.connect uses subscribeToKey to subscribe to keys, but it performs an O(n) iteration over all Onyx keys - even for exact key matches.
This inefficiency becomes a major bottleneck on screens with many Onyx connections (e.g., screens with lists having per-item subscriptions). When entering expense chat on an account with 40k Onyx keys, it spends 900ms looping through them multiple times.
Solution
Optimize subscribeToKey by distinguishing between:
Non-collection keys - use direct lookup instead of iterating through all keys
Collection keys - use current iteration logic
Tested on iOS simulator with 40k keys:
App launch: isKeyMatch total time dropped from 770ms to 330ms
Expense report screen: isKeyMatch dropped from 900ms to 35ms
changed the title [-][$250] Improve the subscribeToKey efficiency in Onyx[/-][+][Due for payment 2025-07-14] [$250] Improve the subscribeToKey efficiency in Onyx[/+]on Jul 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.76-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
@s77rt / @ikevin127@adelekennedy The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
1a. Result of the original design (eg. a case wasn't considered)
1b. Mistake during implementation
1c. Backend bug
1z. Other: Performance improvement
Where bug was reported:
2a. Reported on production (eg. bug slipped through the normal regression and PR testing process on staging)
2b. Reported on staging (eg. found during regression or PR testing)
2d. Reported on a PR
2z. Other: Performance improvement
Who reported the bug:
3a. Expensify user
3b. Expensify employee
3c. Contributor
3d. QA
3z. Other:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: N/A - Performance improvement
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Not needed as the PR for this issue was a performance improvement task.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
[-]Improve the subscribeToKey efficiency in Onyx[/-][+][$250] Improve the subscribeToKey efficiency in Onyx[/+]melvin-bot commentedon Jun 23, 2025
Job added to Upwork: https://www.upwork.com/jobs/~021937284236503470296
melvin-bot commentedon Jun 23, 2025
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ikevin127 (
External)melvin-bot commentedon Jun 23, 2025
Triggered auto assignment to @adelekennedy (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.18 remaining items
[-][$250] Improve the subscribeToKey efficiency in Onyx[/-][+][Due for payment 2025-07-14] [$250] Improve the subscribeToKey efficiency in Onyx[/+]melvin-bot commentedon Jul 7, 2025
Reviewinglabel has been removed, please complete the "BugZero Checklist".melvin-bot commentedon Jul 7, 2025
The solution for this issue has been 🚀 deployed to production 🚀 in version 9.1.76-5 and is now subject to a 7-day regression period 📆. Here is the list of pull requests that resolve this issue:
If no regressions arise, payment will be issued on 2025-07-14. 🎊
For reference, here are some details about the assignees on this issue:
melvin-bot commentedon Jul 7, 2025
@s77rt / @ikevin127 @adelekennedy The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
mountiny commentedon Jul 7, 2025
$250 to @ikevin127
ikevin127 commentedon Jul 10, 2025
BugZero Checklist:
Bug classification
Source of bug:
Where bug was reported:
Who reported the bug:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: N/A - Performance improvement
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue:
Regression Test Proposal
Not needed as the PR for this issue was a performance improvement task.
melvin-bot commentedon Jul 14, 2025
Payment Summary
Upwork Job
BugZero Checklist (@adelekennedy)
JmillsExpensify commentedon Jul 14, 2025
$250 approved for @ikevin127
adelekennedy commentedon Jul 14, 2025
Payment Summary
Contributor+: @ikevin127 due $250 via NewDot
s77rt commentedon Jul 14, 2025
I'm not due payment here ^