--- id: wiki-2026-0508-hermes title: Hermes category: 10_Wiki/Topics status: verified canonical_id: self aliases: [Hermes Engine, React Native Hermes, Hermes JS] duplicate_of: none source_trust_level: A confidence_score: 0.9 verification_status: applied tags: [react-native, javascript-engine, hermes, mobile] raw_sources: [] last_reinforced: 2026-05-10 github_commit: pending tech_stack: language: cpp framework: react-native --- # Hermes ## 매 한 줄 > **"매 mobile 에 매 최적화된 매 ahead-of-time bytecode 매 JS engine."**. Meta 가 매 React Native 용으로 매 만든 engine. 매 startup time + 매 memory + 매 binary size 가 매 우선. 매 2026 의 매 RN 0.70+ 부터 매 default — 매 JSC 대비 매 cold start 30-50% 단축. ## 매 핵심 ### 매 설계 목표 - **Fast startup**: 매 AOT bytecode → 매 parse 비용 0. - **Low memory**: 매 generational GC, 매 NaN-boxing 없는 매 Hades collector (concurrent). - **Small binary**: 매 SymbolTable / StringTable 의 매 dedupe. - **Mobile first**: 매 ARM64 + 매 small heap 의 매 가정. ### 매 Architecture - **Compiler**: hbc (Hermes ByteCode) — 매 build 시 매 .hbc 파일 생성. - **VM**: register-based interpreter — 매 stack-based JSC 와 매 다름. - **GC**: Hades — 매 concurrent + generational. - **No JIT** (default): 매 mobile binary 정책 (iOS) + 매 startup 우선. 매 static Hermes (sh) 가 매 AOT native compile 실험. ### 매 vs JSC vs V8 | 항목 | Hermes | JSC | V8 | |---|---|---|---| | Startup | 매 빠름 (AOT) | 매 보통 | 매 느림 (parse + JIT) | | Throughput | 매 낮음 (no JIT) | 매 보통 | 매 매우 높음 | | Memory | 매 낮음 | 매 보통 | 매 높음 | | 사용처 | RN | iOS Safari, RN (legacy) | Chrome, Node | ### 매 응용 1. RN app cold start 단축. 2. Bundle size 절감 (.hbc 가 .js 보다 작음). 3. 매 Hermes-specific debugger (Chrome DevTools 호환). ## 💻 패턴 ### Enable in RN (already default in 0.70+) ```javascript // android/app/build.gradle project.ext.react = [ enableHermes: true, hermesCommand: "../../node_modules/react-native/sdks/hermes/destroot/bin/hermesc", ] // ios/Podfile use_react_native!( :path => config[:reactNativePath], :hermes_enabled => true, ) ``` ### Verify Hermes is running ```javascript const isHermes = () => !!global.HermesInternal; console.log('engine:', isHermes() ? 'Hermes' : 'JSC'); ``` ### Compile JS to bytecode (CLI) ```bash hermesc -emit-binary -out=index.hbc index.js # Inspect hermes -dump-bytecode index.hbc ``` ### Profile Hermes startup ```bash # Sample profiler hermes --sample-profiling -O index.js # → output trace.json (Chrome DevTools profile format) ``` ### Memory leak detection (Hermes-specific) ```javascript // Heap snapshot import { HermesInternal } from 'react-native'; const snap = HermesInternal?.getInstrumentedStats?.(); console.log(snap); // js_heapSize, js_allocatedBytes, ... ``` ### Avoid Hermes pitfalls ```javascript // 1. eval / new Function — supported but slow (no JIT) // 2. Proxy — supported in 2026 but heavier than V8 // 3. Intl — opt-in (intl=true in build flag), default 작음 // Prefer static patterns const handler = handlers[type]; // O(1) lookup // over const handler = eval(`handle_${type}`); ``` ### Static Hermes (experimental 2026) ```bash # AOT to native — bypass interpreter shermes -typed -exec index.ts # Significant throughput gain when types annotated ``` ### Source map for Hermes bundle ```bash react-native bundle \ --platform android \ --dev false \ --entry-file index.js \ --bundle-output index.android.bundle \ --sourcemap-output index.android.bundle.map \ --minify true # Hermes ingests .map for symbolicated stack traces ``` ## 매 결정 기준 | 상황 | Engine | |---|---| | 매 RN app | Hermes (default) | | 매 cold start critical | Hermes | | 매 heavy compute | JSC + worker / native module | | 매 typed perf-critical RN | Static Hermes (experimental) | | 매 web | V8 / JSC (browser native) | **기본값**: Hermes ON. 매 RN 0.70+ 자동. ## 🔗 Graph - 부모: [[React Native]] - 변형: [[V8]] · [[JavaScriptCore]] - Adjacent: [[Bytecode]] · [[GC]] ## 🤖 LLM 활용 **언제**: 매 RN startup 분석, 매 bundle size 최적화, 매 JS engine trade-off. **언제 X**: 매 web — 매 browser engine 직접 제어 X. ## ❌ 안티패턴 - **eval 의존**: 매 JIT 없음 — 매 매우 느림. - **Bundle 비분할**: 매 .hbc 1개 거대 — 매 RAM bundle / inline-requires 활용. - **JSC 가정 코드**: 매 Symbol toPrimitive 등 매 corner case. - **Hermes 끄고 RN**: 매 거의 매 lose-lose (2026 기준). ## 🧪 검증 / 중복 - Verified (hermesengine.dev, RN 0.74+ release notes). - 신뢰도 A. ## 🕓 Changelog | 날짜 | 변경 | |---|---| | 2026-05-08 | Phase 1 | | 2026-05-10 | Manual cleanup — 매 Hermes architecture + RN integration |