Trung BìnhReact Native iconReact Native

Hermes engine — bật bằng cách nào, đo improvement ra sao?

Hermes là default từ RN 0.70 (Android) và 0.71 (iOS). Dự án mới Expo SDK 50+ và bare CLI đều bật sẵn.

Bật/tắt Hermes:
- Expo: app.json"jsEngine": "hermes" (hoặc "jsc"). Build qua EAS.
- Bare:
- android/gradle.propertieshermesEnabled=true.
- ios/Podfile:hermes_enabled => true. Sau đó pod install.

Đo improvement:

1. Time-to-Interactive (TTI):

ts
import { Performance } from 'react-native'
   // hoặc: const start = global.performance.now()

So sánh TTI giữa Hermes vs JSC build → thường thấy giảm 30–50% trên Android low-end.

2. App size: check .apk/.ipa size. Hermes build thường nhỏ hơn 20–40% nhờ bytecode + bỏ bundle JS plain text.

3. Memory: Android Studio Profiler hoặc Xcode Instruments → so sánh peak memory. Hermes tiết kiệm 20–30%.

4. JS bundle parse time: Trace bằng RN DevTools Performance tab hoặc Systrace (Android). Hermes skip parse step hoàn toàn — bytecode load thẳng vào engine.

Khi nào tắt: chỉ khi gặp lib không tương thích (rất hiếm 2026). Đa số legacy package đã update để hỗ trợ Hermes.

Xem toàn bộ React Native cùng filter theo level & chủ đề con.

Mở danh sách React Native