-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NoQA] feat: react-compiler #42287
[NoQA] feat: react-compiler #42287
Conversation
d09c5c2
to
c90f081
Compare
Perf test are failing on this one. |
ce223c9
to
078dec8
Compare
@Ollyws I fixed jest tests 👍 Validate GH actions is still failing, but I strongly believe it's not related to my changes (I've tried to execute this action/step on a main branch and I'm getting the same output). |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeiOS: NativeiOS: mWeb SafariMacOS: Chrome / SafariMacOS: Desktop |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
We did not find an internal engineer to review this PR, trying to assign a random engineer to #42211 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
@mountiny what are the next steps here? I remember you wanted to discuss it on Monday so it's a friendly reminder 👀 My understanding is that it's pretty stable and we have a control of each file (so we always can disable unnecessary optimizations if needed). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you @kirillzyusko this seems like it works and tests well
I am curious if @roryabraham @AndrewGable have any concerns with adding this now
Should we run an AdHoc regression test to see any thing breaks? It seems like it might be a decent idea |
running |
There are no changes for the failing test on |
Also, does this mean that we should start changing the way we write code such that we don't use |
I feel like the real test here would be to take some optimized but complex/less-readable code in an important component, remove all memoization, and then see how well the React Compiler does to automatically add memoization. |
This comment has been minimized.
This comment has been minimized.
Asked for QA testing https://expensify.slack.com/archives/C9YU7BX5M/p1717521040631869 |
777edc0
to
ec9c2a4
Compare
@AndrewGable I pulled lates main again, and it produced a different output again. I committed modified file, but may I ask you to shed some light on why it happens? I simply added new dependency to |
@roryabraham I think yes, but I would keep writing it - just to see how compiler behaves, and if it really works, then we can gradually abandon manual memoization 🙃
Yeah, can be a very good use case to verify 👍 |
@mountiny may I kindly ask you to re-trigger a new build? I think for a previous build I haven't updated a branch for a pretty long time, so I assume it may have old bugs. Now I rebased all my changes, so it should be in more up-to-date state (but if you think that we can test previous build, then I'm not against it). |
ccc9f4e
to
bfaddad
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to staging by https://github.com/mountiny in version: 9.0.2-0 🚀
|
🚀 Deployed to production by https://github.com/jasperhuangg in version: 9.0.3-7 🚀
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: this PR caused a bug - #42287
@rushatgabhane I think you have linked back to this PR |
🚀 Deployed to production by https://github.com/Julesssss in version: 9.0.5-13 🚀
|
This PR caused a bug where the report name is getting cached. More info #44295 |
Details
Added
react-compiler
that automatically applies necessarymemo
/useMemo
/etc. and improves performance of the app.To add this compiler I had:
eslint
plugin (the PR was merged [React Compiler] usefilename
instead ofcontext.filename
in ESLint plugin facebook/react#29104 -> will be available in next release);react-compiler-runtime
package manually (thereact-compiler-runtime
is available by default inreact@19
, butreact@19
is not compatible with RN 0.73/0.74, so we had to wait before the upgrade - more reasonable was to add missing runtime and link it manually for now);Below two screenshots from
react-devtools
showing that compiler actually works:Warning
As of
[email protected]
the new badge with memo will not be shown (though optimization will be applied. Read an explanation here.After running performance e2e tests I got next results (comparing to current
main
):❇️ Performance comparison results:
➡️ Significant changes to duration
Open Chat Finder Page TTI: 2758.066 ms → 2639.980 ms (-118.086 ms, -4.3%)
➡️ Meaningless changes to duration
App start nativeLaunch: 91.750 ms → 93.517 ms (+1.767 ms, +1.9%)
App start nativeLaunchEnd_To_appCreationStart: 91.737 ms → 90.877 ms (-0.860 ms, -0.9%)
App start appCreation: 108.133 ms → 111.817 ms (+3.683 ms, +3.4%)
App start appCreationEnd_To_contentAppeared: 1116.733 ms → 1108.483 ms (-8.250 ms, -0.7%)
App start contentAppeared_To_screenTTI: 2324.047 ms → 2343.516 ms (+19.469 ms, +0.8%)
App start runJsBundle: 863.983 ms → 849.467 ms (-14.517 ms, -1.7%)
App start TTI: 3745.847 ms → 3750.249 ms (+4.403 ms, ±0.0%)
App start regularAppStart: 0.060 ms → 0.061 ms (+0.000 ms, ±0.0%)
Load Search Options: 403.670 ms → 415.041 ms (+11.370 ms, +2.8%)
Chat opening: 84.929 ms → 87.507 ms (+2.578 ms, +3.0%)
Chat TTI: 1522.559 ms → 1513.895 ms (-8.664 ms, -0.6%)
Fixed Issues
$ #42211
PROPOSAL: N/A
Tests
Offline tests
N/A
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop