Repository navigation
PoC: Simplify the report actions list pipeline and remove repeated work - #106703
Closed
chrispader wants to merge 5 commits into
Closed
chrispader wants to merge 5 commits into
chrispader wants to merge 5 commits into
Conversation
Codecov Report❌ Looks like you've decreased code coverage for some files. Please write tests to increase, or at least maintain, the existing level of code coverage. See our documentation here for how to interpret this table.
|
Mounts the report list and composer on a large account and measures sending and receiving 10 messages, both as renders and as total JS time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Proof of concept. The list's data now passes through one named array per stage (cachedActions, windowActions, reportViewActions, combinedActions, listActions, visibleActions, listData), and every visibility rule is applied in useReportActionsVisibility instead of being split across the model and the list. It also removes work that ran on every message: - All readers of a report share one sort per Onyx value instead of sorting it once each. - visibleReportActions and sortedReportActions recompute only the reports a write can affect (from Expensify#106647) and keep their previous value when nothing changed, so Onyx skips the write and the notifications. - React Compiler can now memoize the list arrays, renderItem, and the row error callbacks. - Rows no longer subscribe to the report's transactions or to the edit text. - Transaction matching, page lookup, and send telemetry no longer scan or sort per item. - Placeholder rows keep their identity, and no Onyx-cached action is mutated anymore. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
chrispader
force-pushed
the
@chrispader/perf/report-actions-pipeline-poc
branch
from
November 16, 2026 16:12
53eec38 to
b56f872
Compare
… list - Rows learn whether they show the editor from a store, so starting or stopping an edit re-renders one row instead of every row. - Only the created row mounts ShowPreviousMessagesButton, and only ACH payment rows read the report's actions for their expected date. - The list model reads each value once and passes it down, and builds the canonical index map only when system messages are collapsed. - getLastVisibleAction checks visibility only for actions newer than its current pick, and sending reuses that result instead of scanning twice. - The deprecated sorted actions cache sorts only the reports a write can change, instead of every report on every write. - visibleReportActions and sortedReportActions skip report writes that change none of their inputs, and visibility checks only the actions that changed. - useAncestors selects only the parent chain, so a write anywhere else doesn't re-render its callers. - The composer maps names only for the rooms and people a message mentions, reads the report without the fields every message changes, and looks for a one-expense thread only in reports that can have one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Take main's lazy mention name maps (Expensify#106086) and one-pass expense matching (Expensify#107294), which already hold the PoC's versions of both. Keep the incremental deprecated sort cache without the one-expense thread merge that main removed, recheck mention whispers when a report moves to another policy, and use the PoC's stage names in main's new code and tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Keep main's useParentReportAction in the report action context menu with the PoC's windowActions name. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 25, 2026
Contributor
Author
|
Note Chris's AI sidekick here (Codex). 🤖 Closing this PoC with broad support for the direction. The work is split into smaller PRs so each change can be reviewed and merged separately. The rollout plan tracks their scope, order, and dependencies. This PR remains the reference implementation. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation of Change
The report actions list builds its rows through a chain of similarly named arrays, and several names mean different things in different files. The chain also repeats work on every message. Each reader of a report sorts it again, two derived values hand every subscriber a new value even when a write changes nothing, and the list re-renders rows whose content didn't change. This proof of concept shows how much simpler and faster the chain gets, so we can agree on the approach before splitting it into smaller PRs.
Each stage now has one name, documented in
useReportActionsListModel:cachedActionssortedAllReportActionswindowActionsreportActions,unfilteredReportActionsreportViewActionsallReportActions,filteredReportActionscombinedActionsreportActionslistActionssortedReportActions,paymentFilteredReportActionsvisibleActionssortedVisibleReportActions,visibleReportActions,paymentFilteredVisibleReportActionsvisibleActionsWithDraftrenderedVisibleReportActionsAll visibility rules now run in
useReportActionsVisibility, including the pay action and support survey rules that lived in the list content. The PoC also removes repeated work:ReportAlternateTextUtilssorted the actions of every report in the account on each write. It now sorts only the reports a write changed.visibleReportActionsandsortedReportActionskeep their previous value when nothing changed, so Onyx skips the write and its notifications. They also skip report writes that don't change their inputs, like a newlastReadTime, andvisibleReportActionschecks only the actions that changed. Recomputing only the reports a write can affect already landed inmainwith Recompute only changed reports invisibleReportActionsandsortedReportActions#106647.renderItem, and the row error callbacks, so a write to a report field the rows don't show no longer re-renders them.lastReadTimeand the last message, anduseAncestorsre-renders only when a report or action in the ancestor chain changes.Two behavior changes are intended. The skeleton decision now ignores hidden pay actions and surveys, like the rendered list. List rows also keep
reportID, whichReportActionItemandActionContentRouterread.Measurements
I measured this branch again on 2026-11-17, after adding the sort cache, derived value, edit, composer, and
useAncestorschanges above.mainis still 7bf05f5, which includes #106647 by twilight2294. That PR makesvisibleReportActionsandsortedReportActionsrecompute only the reports a write can affect, which was most of the improvement in my first measurements. The earlier numbers are archived at the end of this section.The new Reassure scenario
tests/perf-test/ReportScreenMessages.perf-test.tsxmounts the list and the composer on an account with a 500-message chat and 300 other chats. I ran it twice, withmainfirst and then with this branch first.mainThe heartbeat and report name scenarios still render once more than on
main, 28 times instead of 27.The Sentry spans come from production web builds in Chrome with 4x CPU throttling, on an offline account with a 500-message chat and 1,000 other chats. Each build ran 12 interleaved sessions, and the first send of every session counts as a warm-up.
mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatAn A/A run of
mainagainst itself on the web had intervals of up to 10% for sending, so the faster send on the web is close to the noise.The same flow ran on a Samsung Galaxy S10 5G with Android 12 and an iPhone 14 Pro with iOS 27.2.1, with Release HybridApp builds of
mainand this branch installed side by side. Both builds share the same native code and differ only in the JavaScript bundle. Each build ran 12 cold-launched runs interleaved as A, B, B, A. Every run restored the same seeded offline account, opened the 500-message chat, and sent 6 messages, and the first send of every run counts as a warm-up.mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatmainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatI marked both Android builds debuggable to copy the seeded account into them. That slows their Java code equally and doesn't affect Hermes.
An A/A run of
mainagainst itself on the Galaxy S10 showed no difference for any of the three spans, and its intervals stayed within 5%.With the latest changes, sending a message takes 35% less time on the Galaxy S10 and 34% less on the iPhone. The derived work per send drops by 19% on both phones, and the 500-message chat opens 8% faster on the Galaxy S10 and 11% faster on the iPhone. Reassure measures 37% to 39% less JS time to send 10 messages and 34% to 35% less to receive them. In a Jest CPU profile of 10 sends, the deprecated sort cache in
ReportAlternateTextUtilswent from 38 ms to 3 ms, the largest single drop. On the web, sending is 10% faster, which is close to the noise there.I didn't run the iOS simulator and the Android emulator again, because both phones were available. Their numbers from 2026-11-16 are in the archive below.
Second measurements, from 2026-11-16, before the latest changes
I rebased this branch on
mainand measured it again on 2026-11-16. Most of the first improvement came from #106647 by twilight2294, which merged on 2026-11-12. It makesvisibleReportActionsandsortedReportActionsrecompute only the reports a write can affect. This PoC carried the same change when I first measured it, against amainthat didn't have it yet. The numbers below compare againstmainat 7bf05f5, which includes #106647.The new Reassure scenario
tests/perf-test/ReportScreenMessages.perf-test.tsxmounts the list and the composer on an account with a 500-message chat and 300 other chats. I ran it twice, withmainfirst and then with this branch first.mainThe heartbeat and report name scenarios render once more than on
main, 28 times instead of 27.The Sentry spans come from production web builds in Chrome with 4x CPU throttling, on an offline account with a 500-message chat and 1,000 other chats. Each build ran 12 interleaved sessions, and the first send of every session counts as a warm-up.
mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatThe same flow ran on an iOS 27 simulator, an Android 15 emulator, and a Samsung Galaxy S10 5G with Android 12, with Release HybridApp builds of
mainand this branch installed side by side. Both builds share the same native code and differ only in the JavaScript bundle. Each build ran 12 cold-launched runs interleaved as A, B, B, A. Every run restored the same seeded offline account, opened the 500-message chat, and sent 6 messages, and the first send of every run counts as a warm-up. The simulator and the emulator run on the Mac's CPU, so only the change between builds matters there.mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatOne
mainrun on the simulator stopped when the simulator shut down, somainhas 11 runs there.mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatOther work on the Mac slowed six emulator runs in a row, four of them on this branch. That raises both P95s, but not the medians.
mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatI marked both phone builds debuggable to copy the seeded account into them. That slows their Java code equally and doesn't affect Hermes.
On the web, the emulator, and the phone, an A/A run of
mainagainst itself showed no difference for any of the three spans. On the phone, its intervals reached 4.6%, so the faster send and the slower derived work there are close to the noise, while the 10% faster chat open is not.With #106647 in
main, the other changes in this PR gain much less. The Galaxy S10 opens the 500-message chat 10% faster and sends 3% faster, and the iOS simulator sends 5% faster. Reassure measures 8% to 11% less JS time to receive messages and 21% less when a heartbeat field changes. The web and the emulator show no measurable change.First measurements, against
mainbefore #106647 mergedThe new Reassure scenario
tests/perf-test/ReportScreenMessages.perf-test.tsxmounts the list and the composer on an account with a 500-message chat and 300 other chats. I ran it twice, withmainfirst and then with this branch first.mainThe Sentry spans come from production web builds in Chrome with 4x CPU throttling, on an offline account with a 500-message chat and 1,000 other chats. Each build ran 12 interleaved sessions, and the first send of every session counts as a warm-up.
mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatThe same flow also ran on an iOS 27 simulator, with Release HybridApp builds of
mainand this branch installed side by side. Both builds share the same native code and differ only in the JavaScript bundle. Each build ran 12 cold-launched runs interleaved as A, B, B, A. Every run restored the same seeded offline account, opened the 500-message chat, and sent 6 messages, and the first send of every run counts as a warm-up. The simulator runs on the Mac's CPU, so only the change between builds matters.mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatAlmost all of the 339 ms saved per send is derived-value work. On
main, the simulator spends 353 ms of every send rebuilding the derived values, against 106 ms in throttled Chrome. An A/A run ofmainagainst itself showed no difference for sending or the derived work, while its chat-open times differed by up to 15%.On an Android 15 emulator, with Release HybridApp builds and the same 12 interleaved runs per build:
mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatAn A/A run of
mainagainst itself showed no difference for any of the three spans.On a Samsung Galaxy S10 5G with Android 12, with Release HybridApp builds of both installed side by side and 12 interleaved runs per build:
mainmedian (P95)ManualSendMessageVisibleOnyxDerivedCompute, summed per sendManualOpenReport, 500-message chatThe derived-value work is 1,144 ms of the 1,169 ms saved per send. I marked both phone builds debuggable to copy the seeded account into them. That slows their Java code equally and doesn't affect Hermes. I dropped two
mainruns because the phone's lock screen interrupted them. An A/A run ofmainagainst itself showed no difference for any of the three spans, and every interval stayed within 2% of zero. That makes the faster chat open on this phone unlikely to be noise.Reassure's render-only time while sending went up (193 ms to 245 ms, and 184 ms to 266 ms) while the total JS time fell, and the render count stayed the same.
Fixed Issues
$ #107911
PROPOSAL: https://expensify.slack.com/archives/C05LX9D6E07/p1795564470271989
Tests
Offline tests
QA Steps
None. This proof of concept is for review of the approach and will be split into smaller PRs before anything merges.
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
None. The list renders the same rows as before. This PR changes how they are computed, not how they look.
Council review
Rounds: 1
The scores rate the pipeline on
main, before this PR.🤖 Generated with Claude Code