-
Notifications
You must be signed in to change notification settings - Fork 619
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
JSON.stringify() is 3x slower on Hermes than JSC #1008
Comments
Thank you for reporting this. We will look into it. Can you also provide a report for the RegExp slowness? |
Update: we have an internal change that speeds up |
8fd20f2 improves the performance of |
Leaving the task open, since we could still improve further to match JSC. |
We are still having this issue on production with Hermes enabled. Our application is a offline first app.It loads/send a heavy load of JSON structures in order to work offline In heavy use it JSON.stringify 1mb JSON every 15 seconds. The fix was downgrade to JSC engine. |
@lucaswitch RN still hasn't released a version that includes the latest Hermes improvements. Even RN 0.72 includes a version of Hermes from March. The good news is that we are planning to move to a stable Hermes ABI - when that happens you will be able to drop newer versions of Hermes in your project without waiting for the next RN release. The bad news is that for now you need to wait for the next RN release to get the latest improvements, or perhaps for a RN point release to backport them. |
@lucaswitch While the JSON.parse improvements made for #811 have been included in 0.71, the JSON.stringify optimisation in 8fd20f2 is not. You can request a pick for the optimisation into the next point release here: reactwg/react-native-releases#78 |
can we have this commit in the main branch for the hermas? -- 8fd20f2 |
Yes, we will port it. |
thanks @tmikov , you guys are best. Looking forward for static hermas as well in future |
Bug Description
JSON.stringify() is 3x slower on Hermes than JSC.
Hermes version: 0.11.0
React Native version (if any):0.68.8
OS version (if any): Mac OS 13.3
Platform (most likely one of arm64-v8a, armeabi-v7a, x86, x86_64): x86_64
Steps To Reproduce
My testing/benchmarking code: https://gist.github.com/summer-wu/030bd287f8a973d66ff1aa71d7e07569
The Expected Behavior
The performance should be similar.
My opinion
Hermes is good at fast-startup, and provides a easy to use debugger(in Flipper).
But when facing some CPU-intensive tasks, it is slower than JSC. For JSON operation, it is 3x slower(JSON.parse is also slower than JSC #811). For RegExp, it is 10x-20x slower(this is why intl polyfill is slow, #495).
Enabling Hermes is worthy when you need a more quick development cycle, but be aware of those drawbacks
The text was updated successfully, but these errors were encountered: