Before your first screen can draw, the engine has to turn your app's JavaScript into something it can run, and parsing and running that code costs memory and time. Hermes, the engine React Native uses by default, moves the parsing work to build time in release builds. Knowing when that happens, and how to confirm it did, decides whether a startup measurement tells you anything.
Key terms
- Hermes: the open-source JavaScript engine optimized for React Native, used by default with no extra configuration.
- Hermes bytecode: the compiled form of your JavaScript that a release build produces at build time, which the device loads instead of parsing source.
- HermesInternal: a global variable that Hermes defines, which JavaScript can test to verify that Hermes is in use.
- performance.rnStartupTiming: a React Native specific extension of the global
performanceobject that reports when the stages of app startup happened.
Bytecode skips the parse
Plain JavaScript has to be parsed before any of it runs. In a release build, Hermes compiles your JavaScript fully to bytecode ahead of time. Bytecode is loaded into memory on demand and does not need to be parsed the way plain JavaScript does, and that is where the faster startup comes from. For many apps, Hermes also means lower memory use and a smaller app than JavaScriptCore.
You rarely have to turn anything on. The app template sets hermesEnabled=true in android/gradle.properties, and a comment there notes that false switches the app to JSC. Going back to JavaScriptCore is a deliberate opt-out that follows the instructions in the react-native-community/javascriptcore repository.
Why a debug build hides the gain
The bytecode advantage exists only where bytecode was compiled ahead of time, and a debug build usually skips that step. On Android, debuggable variants ship without a JS bundle and need Metro to run, while release variants are bundled and compiled to Hermes bytecode at build time. On iOS, a Debug build for the simulator skips bundling altogether because Metro serves the bundle.
A Debug build for a physical iPhone behaves differently. The build script still bundles it and compiles it to bytecode, with different compiler flags from the ones a release bundle gets. A debug build can therefore contain bytecode, but not the bytecode a release ships, so the benefit of Hermes shows when you compare two release builds.
Confirming the engine at runtime
A new app created from scratch states in its welcome view whether Hermes is enabled. In your own code, test the HermesInternal global with const isHermes = () => !!global.HermesInternal;. The TypeScript globals that ship with react-native declare it as null | {}. The functions on HermesInternal come with limited guarantees and are not meant for wide use, so test that the global exists and leave its methods alone.
With a non-standard way of loading the JS bundle, the global can exist while the app runs without the precompiled bytecode. When startup numbers look wrong, confirm that the app loads the bytecode file, and benchmark before and after the change. The docs call it the .hbc file, but on iOS the build script writes the bytecode under the bundle's own name, main.jsbundle by default, so a search for an .hbc extension finds nothing there.
Reading rnStartupTiming
performance.rnStartupTiming is a getter that returns a ReactNativeStartupTiming object with three documented fields:
startTime: when the app's startup process began, as the native platform reports it. When the platform recorded nothing, it falls back to the moment the React Native runtime started initializing.executeJavaScriptBundleEntryPointStart: when the bundle was loaded and started being evaluated.endTime: when the React Native runtime was fully initialized.
All values are milliseconds relative to the performance time origin, and a duration is one field minus another. Any field can be missing when the platform did not record it, so the startup report example compares each one with == null instead of relying on truthiness, which is the wrong test for a number. Every read of performance.rnStartupTiming asks the native side again and builds a new object, so the example reads it once and destructures it.
The report splits launch at the moment the bundle started evaluating. Comparing both parts across two release builds shows which one a change moved.
In React Native, performance.now() counts milliseconds from system boot, not from app startup, so a raw performance.now() reading is not a launch duration on its own. For launch phases, subtract one rnStartupTiming field from another.
Code Examples
// startupReport.js
const isHermes = () => !!global.HermesInternal;
export function logStartupReport() {
// Read once: each access builds a new object from the native timings.
const {startTime, executeJavaScriptBundleEntryPointStart, endTime} =
performance.rnStartupTiming;
console.log(`engine: ${isHermes() ? 'Hermes' : 'not Hermes'}`);
// Fields can be missing when the platform did not record them.
if (startTime == null || endTime == null) {
console.log('startup timings were not recorded');
return;
}
console.log(`app start to runtime ready: ${endTime - startTime} ms`);
if (executeJavaScriptBundleEntryPointStart != null) {
const beforeBundle = executeJavaScriptBundleEntryPointStart - startTime;
const bundleToReady = endTime - executeJavaScriptBundleEntryPointStart;
console.log(`before the bundle ran: ${beforeBundle} ms`);
console.log(`bundle start to runtime ready: ${bundleToReady} ms`);
}
}