Meta's Hermes: An Open Source JavaScript Engine Optimized for Mobile Apps
Original post Hermes: An Open Source JavaScript Engine Optimized for Mobile Apps
Article Summary
Marc Horowitz from Facebook reveals how they built a JavaScript engine from scratch specifically for mobile constraints. Spoiler: they deliberately skipped the JIT compiler everyone else uses.
Facebook open-sourced Hermes, a new JavaScript engine optimized for React Native apps on resource-constrained mobile devices. Unlike traditional JS engines built for desktop browsers, Hermes prioritizes app startup time, download size, and memory usage over raw CPU performance.
Key Takeaways
- Bytecode precompilation happens at build time, eliminating parse delays at startup
- No JIT compiler: intentional trade-off that improves primary mobile metrics
- Custom garbage collector uses on-demand, noncontiguous memory allocation for 32-bit devices
- MatterMost app showed major improvements in TTI and memory on mid-range Android
- Simple migration: add enableHermes flag to build.gradle and recompile
Hermes sacrifices benchmark performance to dramatically improve real-world mobile app startup time, download size, and memory usage on mass-market devices.
Continue reading
This page summarizes “Hermes: An Open Source JavaScript Engine Optimized for Mobile Apps” by Meta, published Jul 12, 2019. All credit for the original work goes to the authors.