Files
2nd/10_Wiki/Topic_Programming/Coding/RN_Hermes_Optimization.md
T
Antigravity Agent 9148c358d0 docs(10_Wiki): 위키 전체 재구성 — Topic_* 폴더를 4개 카테고리로 통합 + 대규모 중복 제거
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를
Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류.

- 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로
  자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거,
  동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거.
- 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming,
  Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business,
  Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로,
  나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는
  title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백).
  원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지.
- 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서.
- 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는
  지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지.
- Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경.
- 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
2026-07-05 00:33:48 +09:00

3.3 KiB

id, title, category, status, source_trust_level, verification_status, created_at, updated_at, tags, tech_stack, applied_in, aliases
id title category status source_trust_level verification_status created_at updated_at tags tech_stack applied_in aliases
rn-hermes-optimization RN Hermes — Startup / Memory 최적화 Coding draft B conceptual 2026-05-09 2026-05-09
react-native
hermes
performance
vibe-coding
language applicable_to
Hermes / RN 0.70+
React Native
bytecode
AOT
source map
sampling profiler

RN Hermes 최적화

Hermes = RN 의 JS engine (JSC 대체). Bytecode precompile + small heap = 빠른 startup. 0.70+ default. profiler 사용 + 큰 deps 분할 + Hermes-friendly JS 작성이 핵심.

📖 핵심 개념

  • Bytecode (.hbc): build 시 미리 컴파일. 사용자 디바이스 parse 시간 0.
  • Sampling profiler: 무거운 함수 식별.
  • Source map: minified stack → 원본.

💻 코드 패턴

Hermes 활성화 (보통 디폴트)

// android/app/build.gradle (디폴트 enabled)
project.ext.react = [ enableHermes: true ]
// iOS Podfile
use_react_native!(:path => config[:reactNativePath], :hermes_enabled => true)

Sampling profiler

import { Hermes } from 'react-native-hermes';
// dev menu → "Hermes: Enable Sampling Profiler" → 작업 → "Disable" → .cpuprofile 다운로드
// Chrome devtools 또는 React Native debugger 에서 분석

Source map upload (Sentry)

sentry-cli react-native gradle \
  --build-script android/app/build.gradle \
  --release "myapp@1.0.0+1"

Build-time bytecode precompile

RN 0.70+ Hermes 가 release build 에서 자동 .hbc 생성.

무거운 lib 회피

// ❌ moment.js (수백 KB, locale)
import moment from 'moment';

// ✅ date-fns (tree-shake 가능, 작은 import)
import { format } from 'date-fns';

// ✅ 또는 native Intl
new Intl.DateTimeFormat('ko-KR').format(date);

Splash screen 동안 critical asset 만 로드

import * as SplashScreen from 'expo-splash-screen';

SplashScreen.preventAutoHideAsync();

useEffect(() => {
  (async () => {
    await Promise.all([loadFonts(), loadAuthState()]);
    await SplashScreen.hideAsync();
  })();
}, []);

InteractionManager — 무거운 작업 지연

useEffect(() => {
  const handle = InteractionManager.runAfterInteractions(() => {
    // 애니메이션 끝난 후 실행
    heavyWork();
  });
  return () => handle.cancel();
}, []);

🤔 의사결정 기준

측정 도구
Startup time Flipper Hermes profiler
JS frame drop Flipper Performance Monitor
Memory leak Xcode Instruments (iOS), Profiler (Android Studio)
Bundle size source-map-explorer (release bundle)
Native UI thread Systrace / Perfetto

안티패턴

  • moment.js / lodash 통째 import: 번들 폭증. tree-shake / 대체.
  • JIT 가정 (eval, new Function): Hermes 는 JIT 없음 — 런타임 컴파일 X. 디자인 회피.
  • production 에 console.log 남김: bridge 부하. babel plugin 으로 제거.
  • 번들 분석 없이 추측: source-map-explorer.
  • Hermes off + 옛 JSC 유지: startup 느림. 마이그레이션 가능한 한.
  • require 동적 호출 무절제: dead code elim 깨짐.

🤖 LLM 활용 힌트

  • "Hermes 가정. moment 대신 date-fns 또는 Intl. console.log production 제거."
  • profiler 측정 후 최적화.

🔗 관련 문서