Making Hermes the Default JavaScript Engine
Article Summary
Meta's Hermes team cut app startup time in half and reduced GC pauses by 34x. Here's how they're making it the default engine for React Native.
Meta's React Native team details the two-year journey to make Hermes the default JavaScript engine across all React Native platforms. The article covers major technical improvements including a new garbage collector, memory optimizations, and community-driven feature additions.
Key Takeaways
- New Hades GC reduces pause time to 48ms at p99.9 (34x faster than GenGC)
- 32-bit encoding slashed JavaScript heap size by 30%, total memory down 45%
- Hermes on iOS delivers 40% faster startup and 18% less memory vs JSC
- Babel transform optimizations achieved 18-25% TTI improvements on Facebook surfaces
- Community-requested Proxy and Intl APIs added with minimal size impact (57-62K)
Hermes delivers dramatic performance wins through ahead-of-time compilation, concurrent garbage collection, and aggressive memory optimization while expanding from Android-only to iOS, Windows, macOS, and VR platforms.
About This Article
React Native apps on Android had a serious problem with UI thread blocking. Hermes's garbage collector ran on a single thread and would pause everything to clean up memory. These pauses averaged 200ms, and in the worst cases on Facebook's app, they hit 7 seconds.
Meta's Hermes team built Hades, a new garbage collector that runs most of its work in the background. It uses a snapshot-at-the-beginning mark-sweep strategy for older memory sections, so JavaScript execution doesn't get blocked while collection happens.
Hades brought GC pause times down to 48ms at p99.9 on 64-bit devices and 88ms on 32-bit devices. The team also optimized memory usage through aggressive header layout compression, which cut memory by another 15% on top of the 30% savings they already got from 32-bit encoding.