Why React Native uses Hermes to compile JavaScript into bytecode at build time instead of JIT compiling on mobile devices.
Pre-baking and packaging a pizza in an industrial kitchen so the customer can microwave it in 30 seconds, rather than shipping raw flour, yeast, and tomatoes for the customer to bake from scratch on a small camp stove.
Build step: Hermes compiler (hermesc) parses JavaScript bundle into AST
Emits pre-optimized Hermes Bytecode (HBC) binary file
App startup: Mobile OS maps HBC file directly into virtual memory (mmap)
Engine skips parsing and bytecode generation steps entirely
Initial screen executes in <50ms with a compact generational garbage collector
// android/app/build.gradle (Enabling Hermes Engine)
project.ext.react = [
enableHermes: true, // Compiles JS to HBC bytecode Ahead-of-Time
]
// Startup performance benchmark:
// V8/JSC: Parse + JIT warmup = ~1,200ms TTI, 45MB RAM
// Hermes: Memory-mapped HBC = ~240ms TTI, 18MB RAM (80% faster startup!)Memory mapping (mmap) bytecode allows the OS to share and discard clean bytecode pages under memory pressure without killing the app process.