Perf-Onyx-optimize-get-all - #95511
Conversation
|
|
|
@mkhutornyi 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] |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppandroid2.movAndroid: mWeb ChromeiOS: HybridAppios2.moviOS: mWeb SafariMacOS: Chrome / Safariweb2.mov |
| "react-native-nitro-modules": "0.35.0", | ||
| "react-native-nitro-sqlite": "9.6.0", | ||
| "react-native-onyx": "3.0.88", | ||
| "react-native-onyx": "github:Expensify/react-native-onyx#492160a7e981a90ab458978dce5d1624938cb16c", |
There was a problem hiding this comment.
Onyx PR was merged so bump Onyx version
| "react-native-nitro-modules": "0.35.0", | ||
| "react-native-nitro-sqlite": "9.6.0", | ||
| "react-native-onyx": "3.0.88", | ||
| "react-native-onyx": "github:Expensify/react-native-onyx#492160a7e981a90ab458978dce5d1624938cb16c", |
There was a problem hiding this comment.
This will need to bump to 3.0.91, but there are some other versions in the queue that need to be done first. namely Expensify/react-native-onyx#799 and Expensify/react-native-onyx#801
|
@rinej Could you put this PR into draft state? As stated by Rory we still have some PRs in the bump queue before we get into this one. |
|
Ok, converting to draft. Will reopen after we bump the Onyx |
|
sound great! I will resolve conflict and prepare proper PR |
|
@chrispader @rinej #93438 was merged but we need to wait until it at least hit Staging for one/two days so we can catch regressions |
|
Ok, I merged main and resolved the conflicts. Now waiting for the green light once the previous release finishes testing |
ReviewThis is a clean dependency bump. The App-side diff is only The real change lives in the merged onyx PR (Expensify/react-native-onyx#805), which rewrites Points worth confirming1. Values now round-trip through SQLite's JSON serializer. Previously 2. Single aggregated string. The whole DB is now materialized as one JSON string in SQLite, then parsed — a transient memory spike (string + parsed structure held simultaneously) proportional to DB size, and subject to 3. Perf benefit. The PR description itself notes the gain is "~11%, within noise." Given (1) and (2), it's worth confirming the team considers the win worth the added serialization path — not a blocker, just a judgment call. Order isn't guaranteed by Since |
Regression scanThe App diff itself is regression-free — it's a pure Top risk — this can fail closed on native cold start. Details & the three regression vectors1. Fail-closed hydration (behavior change, verified). The old code parsed rows individually in JS (
2. Silent value alteration (new invisible failure mode). Old path returned values parsed byte-for-byte by V8 from the stored text. New path round-trips each value through SQLite's 3. Memory / size ceiling on large accounts. The whole DB is now materialized as a single JSON string inside SQLite, then held in JS alongside the parsed result — a transient memory spike proportional to DB size, bounded by Test gap (verified). The tests added in #805 cover only the happy path (5 rows) and an empty table — none exercise large payloads, deep nesting, unicode/surrogate edge cases, or numeric precision, so vectors 1–3 are currently unguarded. Non-issues I checked: empty table returns Suggestion: before merge, sanity-check the tester's high-traffic-account cold-start (the checklist item covers the memory/large-payload angle), and add unit tests for a lone-surrogate string and a deeply-nested object to lock down vector 1. Since this is native-only, mWeb/desktop are unaffected. |
|
Codex Review: Didn't find any major issues. Keep them coming! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
|
I merged main and it's ready for review. I also did some smoke testing, and it looks good 1-Onyx.mp4 |
|
@mkhutornyi please have a look, when you got a moment |
|
🚧 mountiny has triggered a test Expensify/App build. You can view the workflow run here. |
This comment has been minimized.
This comment has been minimized.
|
I just merged the main again now, should be good now |
|
Is this ready to get merged now? @fabioh8010 👀 |
|
I think we are just waiting on @roryabraham review |
mountiny
left a comment
There was a problem hiding this comment.
C+ already approved I will move this one ahead to make the queue flowing
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
|
🚧 mountiny 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/mountiny in version: 9.4.49-0 🚀
|
|
🚀 Deployed to production by https://github.com/arosiclair in version: 9.4.49-3 🚀
Bundle Size Analysis (Sentry): |

Explanation of Change
Bumps react-native-onyx to pull in Expensify/react-native-onyx#805, which optimizes SQLiteProvider.getAll().
Previously getAll() fetched every row from keyvaluepairs and ran JSON.parse once per row (N parses) to hydrate the Onyx cache at startup. It now asks SQLite to aggregate the whole table into a single JSON string.
Fixed Issues
$ #89652 (comment)
PROPOSAL:
Tests
Offline tests
QA Steps
Same as Tests
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)Avatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))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
Android-getAll-Perf.mp4
Android: mWeb Chrome
iOS: Native
iOS-getAll-Perf.mp4
iOS: mWeb Safari
MacOS: Chrome / Safari