-
-
Notifications
You must be signed in to change notification settings - Fork 668
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
Android: Use Hermes #4131
Comments
See zulip#4131, the issue for activating Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two parts. First, and released in RN v0.60.0, they started using NPM to manage the JSC version. This part corresponds to - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) Then: - In 0.60.1, facebook/react-native@e857d7066 was released, giving Hermes support. - In 0.60.2, facebook/react-native@0738fe573 was released, fixing an error in the template app. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
See zulip#4131, the issue for activating Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two parts. First, and released in RN v0.60.0, they started using NPM to manage the JSC version. This part corresponds to - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) Then: - In 0.60.1, facebook/react-native@e857d7066 was released, giving Hermes support. - In 0.60.2, facebook/react-native@0738fe573 was released, fixing an error in the template app. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
See zulip#4131, the issue for activating Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two parts. First, and released in RN v0.60.0, they started using NPM to manage the JSC version. This part corresponds to - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) Then: - In 0.60.1, facebook/react-native@e857d7066 was released, giving Hermes support. - In 0.60.2, facebook/react-native@0738fe573 was released, fixing an error in the template app. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
I think this may also block on Hermes growing support for |
Interesting. We probably want to at least prototype running Hermes even if it breaks i18n, just to get a sense of what the performance impact and discover any other things we need to fix on our end. |
See zulip#4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
I'm very excited about this! |
You can import some polyfills for android, ex:
We've used to do something like this in the past but we're currently using react-native-v8. |
See zulip#4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
@felippepuhle Interesting! I hadn't been really aware of react-native-v8. I just looked around on the Web and found some benchmark reports, and it seems like react-native-v8 makes different tradeoffs from Hermes. I'd be very curious to hear more, if you'd be up for sharing, about why you switched from Hermes to react-native-v8 🙂 . Either on this thread, or on #mobile on chat.zulip.org, which might be a more convenient venue for discussion. |
See zulip#4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
See #4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
See zulip#4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
See zulip#4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
See zulip#4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
See zulip#4131, the issue for enabling Hermes. Part of the RN v0.59 -> v0.60 upgrade [1]. This must happen at or after the upgrade commit because the use of Hermes is newly supported. RN did this in two main steps that affected the template app, which we squash together in this commit. RN's first step was to start using NPM to manage the JSC version; this was released in v0.60.0: - facebook/react-native@8e375850d - facebook/react-native@4bb0b4f20 (a partial reversion) RN's second step was a large amount of setup to get Hermes ready, released in v0.60.1: - facebook/react-native@e857d7066 - Then facebook/react-native@0738fe573 fixed a small bug, released in v0.60.2. All four of the above-mentioned commits are reflected in this commit. [1]: https://react-native-community.github.io/upgrade-helper/?from=0.59.10&to=0.60.6
Hmm, I'm getting a "Too many handles allocated in GCScope" error after changing Continuing the discussion here. |
Awaiting a response to a React Native issue; see discussion here. This will no longer block the RN v0.61 upgrade. |
We don't want to be using JavaScriptCore forever, if we can avoid it; we're tracking the switch to Hermes as zulip#4131. For now, though, this tiny code change will allow `react-intl` to work on Android. A `react-intl` doc [1] links to instructions [2] [3] to use a variant of JavaScriptCore that supports `Intl`. So, follow those instructions. The reported additional 6MiB per architecture may become a concern, I'm not sure. But this seems like the correct lever to pull if we want to simply support `react-intl` without doing an investigation to determine the exact set of polyfills we'd otherwise need, and adding up the weight *they* would add to builds. [1] https://formatjs.io/docs/react-intl/#react-native [2] https://github.com/react-native-community/jsc-android-buildscripts#international-variant [3] They're slightly out-of-date, currently, but it's still easy to tell what to do; see facebook/react-native@d7f5153cd#diff-b8dd15c78827c1b48f9fe21c45686142R100-R111 for the new edit to make to `android/app/build.gradle`.
"Too many handles allocated in GCScope" is an internal issue in Hermes. I don't know what version you're using, but if you can file an issue on the hermes repo with as much repro information as you can, we can look into it. This error is usually easy to debug with a native stack trace. |
We don't want to be using JavaScriptCore forever, if we can avoid it; we're tracking the switch to Hermes as zulip#4131. In fact, Hermes doesn't yet support Intl. For now, this tiny code change will allow `react-intl` to work on Android. A `react-intl` doc [1] links to instructions [2] [3] to use a variant of JavaScriptCore that supports `Intl`. So, follow those instructions. Reportedly, this change will add 6MiB per architecture. zulip#3547 was recently resolved, though, giving us some wiggle room. [1] https://formatjs.io/docs/react-intl/#react-native [2] https://github.com/react-native-community/jsc-android-buildscripts#international-variant [3] They're slightly out-of-date, currently, but it's still easy to tell what to do; see facebook/react-native@d7f5153cd#diff-b8dd15c78827c1b48f9fe21c45686142R100-R111 for the new edit to make to `android/app/build.gradle`.
We don't want to be using JavaScriptCore forever, if we can avoid it; we're tracking the switch to Hermes as zulip#4131. In fact, Hermes doesn't yet support Intl. For now, this tiny code change will allow `react-intl` to work on Android. A `react-intl` doc [1] links to instructions [2] [3] to use a variant of JavaScriptCore that supports `Intl`. So, follow those instructions. Reportedly, this change will add 6MiB per architecture. zulip#3547 was recently resolved, though, giving us some wiggle room. [1] https://formatjs.io/docs/react-intl/#react-native [2] https://github.com/react-native-community/jsc-android-buildscripts#international-variant [3] They're slightly out-of-date, currently, but it's still easy to tell what to do; see facebook/react-native@d7f5153cd#diff-b8dd15c78827c1b48f9fe21c45686142R100-R111 for the new edit to make to `android/app/build.gradle`.
We don't want to be using JavaScriptCore forever, if we can avoid it; we're tracking the switch to Hermes as zulip#4131. In fact, Hermes doesn't yet support Intl. For now, this tiny code change will allow `react-intl` to work on Android. A `react-intl` doc [1] links to instructions [2] [3] to use a variant of JavaScriptCore that supports `Intl`. So, follow those instructions. Reportedly, this change will add 6MiB per architecture. zulip#3547 was recently resolved, though, giving us some wiggle room. [1] https://formatjs.io/docs/react-intl/#react-native [2] https://github.com/react-native-community/jsc-android-buildscripts#international-variant [3] They're slightly out-of-date, currently, but it's still easy to tell what to do; see facebook/react-native@d7f5153cd#diff-b8dd15c78827c1b48f9fe21c45686142R100-R111 for the new edit to make to `android/app/build.gradle`.
Looks like we can expect Hermes to have Intl support with the React Native v0.65 release: facebook/hermes#23 (comment) |
There's an issue in RN v0.65 that I think affects apps using Hermes on Android, and it's reportedly fixed in RN v0.66: facebook/react-native#32197 (comment). #5372 is open for the RN v0.66 upgrade. |
I'm taking a look at this now. (It looks like it'll be helpful for #5589 .) The first obstacle I hit is a crash that appears to be facebook/hermes#602. That was fixed in RN v0.68, for which our upgrade issue is #5344. There's a suggested workaround by monkey-patch on that thread. I may try that in order to unblock Hermes; but if we do switch, that will probably add a reason to catch back up on RN upgrades. |
This didn't suffice. It worked as far as it goes -- it appeared to fix Reading a bit more closely the Hermes commit that fixed the issue, it seems clear that a number of other Intl-related methods are affected. There doesn't seem to be a good way of identifying which of them is triggering the issue; there may also not be workarounds possible for some of them that are as straightforward as that one for |
Completed that RN v0.68 upgrade #5344 yesterday; picking this back up again. |
Update today:
|
This will be possible following the RN 60 upgrade, #3548.
The guide we'll want to follow is at https://reactnative.dev/docs/0.61/hermes (or https://reactnative.dev/docs/0.62/hermes if we're on RN v0.62 when we get to this), including all the steps to ensure it's enabled properly.
The text was updated successfully, but these errors were encountered: