-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
Hermes seems to take longer to process large promises inside React Native #41631
Comments
@cortinico the submitter indicates that the problem is in React Native, not Hermes - does it make sense to transfer it to Hermes? It is very difficult for us to investigate issues inside RN. |
Ahh I missed the linked issue. This probably belongs to React Native but I don't think we'll have capacity to investigate this one as of today |
@cortinico I suspect that we need to work together on this. As it is today, Hermes promises are just a polyfill, so they are not terribly efficient (cough cough), and frankly we don't really fully understand that code. Some complex interaction must be happening in RN, but it clearly has something to do with Hermes too. Do we use the promise polyfill with JSC? If that is the case, it would be interesting to run an experiment with JSC in jitless mode (for example, when running on iOS hardware - not Simulator). |
I asked another developer on our team to pull and run the hermes-promise-test test repository on an actual iOS device (ensuring jitless mode was activated). Here are the release mode screenshots. JSC:Hermes: |
Hi all, I realize I'm a little late to this, but I may have an application that may make regression testing across react native versions more simple. If anyone on the RN team at meta is interested, please feel free to ping me for an invite to the repository. This app is 100% react native and doesn't use any libraries that could hide some performance related stuff in components or animations. Everything is pure react-native public api's. https://apps.apple.com/us/app/word-clouds/id1435511292?platform=iphone My short observations with hermes is that it is significantly slower at runtime. There's also been a regression in JS thread performance between 0.64 and 0.7x (not related to hermes). Obviously we could chalk this up to JS core, but I'm a skeptic given the extremity of recent changes in RN architecture. Anyway, I'd like to offer up my game to you guys if you'd like it to use for benchmark testing. I've swapped RN versions in and out over the last 4-5 years and there's a clear performance trend downward. |
For connecting the dots:
|
Exactly the same issue with Hermes: Dependencies for React Native Windows: npmPackages:
The test was done on these different machines, exactly the same result: Processor & Memory Processor & Memory Processor & Memory |
Description
Hermes seems to take longer to process large promises inside React Native when compared to other JavaScript engines such as JavaScriptCore (Android) and Chakra (Windows).
I have recently reported this issue with the Hermes engine at facebook/hermes#1024. However, after setting up a command line comparison vs React Native, it would appear that there is some configuration or integration with Hermes that is causing the slowdown to occur within React Native and not the command line. I'm not sure if this is related some of the diagnostic hooks or some metro configuration.
The issue persists in both Debug and Release, see "Steps to reproduce".
Please note, my team's concern is primarily with the Release performance, any workaround would be appreciated.
React Native Version
0.72.6
Output of
npx react-native info
info Fetching system and libraries information...
System:
OS: Windows 10 10.0.19044
CPU: (16) x64 Intel(R) Core(TM) i9-10885H CPU @ 2.40GHz
Memory: 16.42 GB / 31.75 GB
Binaries:
Node:
version: 20.9.0
path: C:\Program Files\nodejs\node.EXE
Yarn:
version: 1.22.19
path: C:\Program Files (x86)\Yarn\bin\yarn.CMD
npm:
version: 10.1.0
path: C:\Program Files\nodejs\npm.CMD
Watchman: Not Found
SDKs:
Android SDK: Not Found
Windows SDK:
AllowDevelopmentWithoutDevLicense: Enabled
AllowAllTrustedApps: Enabled
Versions:
- 10.0.19041.0
- 10.0.22000.0
- 10.0.22621.0
IDEs:
Android Studio: AI-223.8836.35.2231.10811636
Visual Studio:
- 17.4.33829.165 (Visual Studio Enterprise 2022)
Languages:
Java:
version: 11.0.20
path: C:\Program Files\Microsoft\jdk-11.0.20.8-hotspot\bin\javac.EXE
Ruby: Not Found
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.6
wanted: 0.72.6
react-native-windows:
installed: 0.72.16
wanted: 0.72.16
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: Not found
newArchEnabled: Not found
Steps to reproduce
yarn install
andyarn react-native start
(oryarn react-native run-android
).If you use Hermes directly, the time will be about 7x that of JavaScriptCore (Android) or Chakra (Windows).
However, if you pull the command line version hermes-promise-cli and execute it with Hermes directly, Hermes will resolve these within 600 ms or less and will outperform Chakra on the command line.
Snack, screenshot, or link to a repository
Screenshots
The text was updated successfully, but these errors were encountered: