Paul Krill
Editor at Large

Facebook JavaScript engine boosts React Native on Android

news
Jul 15, 20192 mins

Open-source Hermes JavaScript engine could be used to improve performance of all JavaScript-based mobile applications

Facebook has built a JavaScript engine, called Hermes, that improves the performance of React Native applications on Android devices. While the open-source engine is optimized for React Native today, it could be used to improve the performance of JavaScript-based mobile applications generally. 

Specifically, Hermes is geared to fast startup, leveraging compact bytecode and ahead-of-time static optimization. In many cases, enabling Hermes will improve startup time, decrease memory usage, and result in smaller app size.

Hermes currently is an opt-in feature in React Native. Most of Facebook’s React Native products on Android are already using Hermes, including Crisis Response and the Oculus companion app.

Hermes JavaScript engine features

Hermes capabilities include:

  • Instead of parsing and compiling JavaScript on-device while the user waits, that work can be done at build time.
  • Ahead-of-time compilation allows for more-complex optimizations. Identical functions can be found in a program and de-duplicated. Strings from JavaScript code can be packaged together into an efficient storage form with no runtime overhead.
  • A small Android APK size.
  • Bytecode can be memory-mapped and loaded from flash memory incrementally as needed.
  • Virtual address space is allocated in chunks on demand as needed, avoiding the need to estimate the heap size and minimizing overhead. Freed memory can be returned to the OS. Also, garbage collection pauses are minimized.
  • Implements JavaScript standards, with Hermes targeting ECMAScript 2015, also known as ES6. JavaScript features not commonly used in React Native applications have been omitted.

Facebook has also open-sourced Hermes’ integration with React Native, so developers can opt into using Hermes immediately. The company plans to build time and memory profiling tools for Hermes and to add support for the Visual Studio Code debugging protocol. 

Where to download Hermes

You can download Hermes from GitHub. Instructions for enabling the use of Hermes can be found on the React Native website.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author