Skip to content

Hermes will be the default engine in React Native 0.70

updated

The React Native team has announced that React Native 0.70 will ship with Hermes as the default JavaScript engine. All new projects created on v0.70 will have Hermes enabled out of the box, following work that began last October. Support for other engines will continue, and developers do not need to wait for 0.70: Hermes can already be enabled on existing apps.

Why Hermes

Hermes targets resource-constrained devices and focuses on startup time, app size and memory usage. A key difference from other JS engines is ahead-of-time compilation of JavaScript to bytecode. That bytecode is bundled in the binary, so the interpreter skips this costly step when the app launches.

Benchmarks

The team measured three metrics using the Mattermost app on 2020 high-end hardware: a Samsung Galaxy S20 for Android and an iPhone 12 Pro for iOS.

  • TTI (time to interactive): measured from tapping the app icon until the first screen renders, with screen recordings included in the post.
  • Binary size: APK size on Android and IPA size on iOS.
  • Memory consumption: collected while performing the same actions in Mattermost over a couple of minutes on each engine.

The full benchmark charts and videos are available in the original post.

Hermes built alongside React Native

Previously, React Native consumed Hermes as prebuilt binaries distributed through CocoaPods and npm, which could lead to API or ABI incompatibilities and caused recurring problems during releases. Starting with React Native 0.69, Hermes is built together with every React Native version. This guarantees compatibility between the two, and the team says the tighter integration allows faster iteration on features and bug fixes.

Intl on iOS

The iOS implementation of Intl, the ECMAScript Internationalization API, is now complete. The Android side, built in partnership with Microsoft, shipped in React Native 0.65, so with 0.70 both platforms will have native support. The missing API had kept some developers from adopting Hermes.

Rather than bundling large lookup tables such as Unicode CLDR, which could add up to 6MB, the iOS implementation calls into APIs that iOS already provides. That approach reuses the locale data on the device and keeps the Hermes binary small.

What's next

The team's near-term priorities are developer experience and filling gaps in JavaScript language features:

  • Running the sampling profiler directly from the Chrome devtools UI.
  • Adding BigInt support, a long-standing community request that cannot be polyfilled.
  • Adding WeakRef, which will give developers new memory management controls.

Feedback

The team has created a hermes label on its GitHub repo for bugs, questions, feedback and ideas related to Hermes.

Source: reactnative.dev