react-native: enableHermes on React Native 0.60.3 is extremely slow.
I’m testing with two real devices and an emulator. They are all extremely slow with the hermes flag enabled. Had to enabled it for 0.60.3 😦
By extremely slow, pressing something takes about 3 seconds for it to react.
App was working fine before swiching flag.
My configuration is as such: (Hidious I know)
app/build.gradle
apply plugin: "com.android.application"
import com.android.build.OutputFile
apply plugin: 'io.fabric'
repositories {
maven { url 'https://maven.fabric.io/public' }
}
project.ext.react = [
entryFile: "index.js",
enableHermes: true,
]
def jscFlavor = 'org.webkit:android-jsc:+'
def enableHermes = project.ext.react.get("enableHermes", false)
apply from: "../../node_modules/react-native/react.gradle"
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
defaultConfig {
applicationId "com.magicword.ahahah"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 46
versionName "1.4.1"
ndk {
abiFilters "armeabi-v7a", "x86", "arm64-v8a"
}
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
}
lintOptions {
abortOnError false
}
buildTypes {
debug {
manifestPlaceholders = [isDebug: true]
}
release {
manifestPlaceholders = [isDebug: false]
minifyEnabled false
useProguard true
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
}
}
// applicationVariants are e.g. debug, release
applicationVariants.all { variant ->
variant.outputs.each { output ->
// For each separate APK per architecture, set a unique version code as described here:
// http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits
def versionCodes = ["armeabi-v7a": 1, "x86": 2]
def abi = output.getFilter(OutputFile.ABI)
if (abi != null) { // null for the universal-debug, universal-release variants
output.versionCodeOverride =
versionCodes.get(abi) * 1048576 + defaultConfig.versionCode
}
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
packagingOptions {
pickFirst 'lib/x86/libc++_shared.so'
pickFirst 'lib/x86_64/libjsc.so'
pickFirst 'lib/arm64-v8a/libjsc.so'
pickFirst 'lib/arm64-v8a/libc++_shared.so'
pickFirst 'lib/x86_64/libc++_shared.so'
pickFirst 'lib/armeabi-v7a/libc++_shared.so'
}
}
dependencies {
implementation 'com.android.support:multidex:1.0.3'
implementation project(':react-native-iap')
implementation project(':react-native-location')
implementation project(':react-native-fbsdk')
implementation project(':react-native-navigation')
compile fileTree(include: ['*.jar'], dir: 'libs')
// Android stuff
implementation 'com.google.android.material:material:1.0.0'
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:support-annotations:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:animated-vector-drawable:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:customtabs:${rootProject.ext.supportLibVersion}"
implementation "com.android.support:design:${rootProject.ext.supportLibVersion}"
//Google stuff
implementation "com.google.android.gms:play-services-location:16.0.0"
implementation 'com.google.android.gms:play-services-identity:16.0.0'
implementation "com.google.android.gms:play-services-base:17.1.0"
// Maps
// React native stuff
implementation 'com.facebook.react:react-native:+'
// From node_modules
// Facebook
implementation 'com.facebook.android:facebook-android-sdk:4.38.1'
// Firebase stuff
implementation project(':react-native-firebase')
implementation 'com.google.firebase:firebase-core:16.0.8'
implementation 'com.google.firebase:firebase-firestore:18.2.0'
implementation 'com.google.firebase:firebase-storage:16.1.0'
implementation 'com.google.firebase:firebase-auth:16.2.1'
implementation 'com.google.firebase:firebase-messaging:17.5.0'
implementation 'com.google.firebase:firebase-functions:16.3.0'
compile('com.crashlytics.sdk.android:crashlytics:2.9.2@aar') {
transitive = true
}
compile project(path: ':lottie-react-native')
compile project(path: ':rn-fetch-blob')
compile project(path: ':react-native-linear-gradient')
compile project(path: ':react-native-image-crop-picker')
compile project(path: ':react-native-maps')
compile project(path: ':react-native-device-info')
compile project(path: ':react-native-cookies')
compile project(path: ':react-native-cookies')
compile project(path: ':react-native-webview')
if (enableHermes) {
def hermesPath = "../../node_modules/hermesvm/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
releaseImplementation files(hermesPath + "hermes-release.aar")
} else {
implementation jscFlavor
}
}
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
}
apply plugin: 'com.google.gms.google-services'
// https://stackoverflow.com/questions/51839721/the-library-com-google-firebasefirebase-iid-is-being-requested-by-various-other
//com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
android/build.gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext {
buildToolsVersion = "28.0.3"
minSdkVersion = 21
compileSdkVersion = 28
targetSdkVersion = 27
supportLibVersion = "28.0.0"
googlePlayServicesVersion = "16.1.0"
androidMapsUtilsVersion = "0.5+"
}
repositories {
google()
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenLocal()
jcenter()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath 'com.google.gms:google-services:4.3.0'
classpath 'io.fabric.tools:gradle:1.+'
// NOTE: Do not place your application dependencies here; they belong
// In the individual module build.gradle files
}
}
allprojects {
repositories {
google()
maven { url 'https://maven.google.com' }
maven { url "https://jitpack.io" }
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url "$rootDir/../node_modules/react-native/android"
}
mavenLocal()
jcenter()
}
}
//Force all projects to use the same build tools.
subprojects {
afterEvaluate {project ->
if (project.hasProperty("android")) {
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
}
}
}
}
subprojects {
project.configurations.all {
resolutionStrategy.eachDependency { details ->
if (details.requested.group == 'com.android.support'
&& !details.requested.name.contains('multidex') ) {
details.useVersion "28.0.3"
}
if (details.requested.group == 'androidx.core'
&& !details.requested.name.contains('androidx') ) {
details.useVersion "1.0.1"
}
}
}
}
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 39
- Comments: 81 (10 by maintainers)
I am using 0.61.1, it’s very slow, please let me know how to solve this. after completing this app, I’ll never work on react native.
fuck react native
@BartJanvanAssen thanks for the reply but we no longer do React Native (Flutter is far far superior) 😎😎
Closing after several months without followup from the author. Please make sure to fill in the issue template if you decide to file a new issue.
I lost hours trying to improve my app performance and now im here. ☹️
@ollydixon This is what I’ve got so far:
It seems that loading hermes is the fallback for when loading JSC fails, which is why our apps crash with that error message, since hermes wasn’t setup at all due to
enableHermes: false
and there’s no further error-handling in this case.In order to fix the initial problem, I added the following to the android-level
build.gradle
-file:./gradlew clean
after that, and my issues go away in the sense that I can properly opt out of using Hermes.I’m not really sure what changed when it comes to how JSC is loaded, but I might try to make sense of that this weekend, I’m a bit too pressed by other deadlines to further look into it right now.
Here’s what my files look like right now:
android/app/build.gradle
:android/build.gradle
:Thanks for submitting your issue. Can you take another look at your description and make sure the issue template has been filled in its entirety?
👉 Click here if you want to take another look at the Bug Report issue template.
Hermes only slow on Debug mode, on a release build it’s much faster and i can reduce my app from ~40MB to 17MB.
Experiencing similar issues, though I’m using RN 0.60.4.
I’ve been having similar issues. A regex heavy task which took 3-5 seconds with hermes enabled took 40-50 seconds with hermes enabled!
With @Zloka 's suggestion I was able to disable Hermes and saved myself from tearing my hair out!
I’m using Hermes in “true” in RN 0.60.6 and it works extremely fast. Now my app loads 2x faster that when Hermes was in “false”. (Release mode)
@Zloka I can’t revert back from hermes now otherwise the SoLoader fails. The project is stuck now, any ideas?
Looks like i got it working on the 0.61.5 version. i failed to fill the android/build.gradle file correctly… I did change the file but notice i had 2 places where i had to change the maven config 1st place is the allprojects => repositories. the second one is the buildscript => repositories. i forgot the first one and kept on searching for days for this to fix… maybe i can help someone 😉
I just upgraded to React Native 0.60.5 just to try Hermes because my Android app was really slow, but it made my app to go from slow to ultra slow. It’s totally unusable with Hermes enabled.
Thanks @Arshimonde. I tried this but it didn’t help me:
@wmonecke it’s not an issue with RN though it’s more that it’s not a container. It will always have significant platform bugs introduced by Android manufacturers and iOS updates and Android API changes. This isn’t the case with Flutter since it effectivity runs on it’s own engine.
I found that over the years, RN was pushing extremely broken and immature updates and using technologies that were new or not completed. For people who develop apps for multiple companies it was becoming a huge time sink to be on top of this. Also the navigation is still horrid. Debugging on Android is useless. Etc etc
Not only that; be we picked up hundreds of bugs across Android manufactures and design inconsistencies with our RN projects; which was the straw that broke the camels back.
If you’re a professional developer, my advice is to stay very far from RN and use something like Flutter.
Even Native Android dev is broken; some of the manufacturers override default styles and margins, for example (many other things, like broken standard APIs; look at file management, for example.)
😃
Why react native 0.63 very slow .?
After an hour or two of bashing my head against the wall, this comment fixed my issue. Thanks! I didn’t realise it was the bottom section that needed the fix.
@ollydixon Yup, just noticed I have the same issue when I figured I’d forego using hermes for now. Application builds just fine, but crashes on launch with the following output:
same error in react-native 0.63.0
Android 5.0.2 Device Galaxy A5 Release 2015 6 third party Native plugin react-native v 0.61.2
It get launch in 8 seconds.
Wow very slow, how can I faster it
0.65.1 with hermes debug builds seems to be extremely slow in Android. Not just the startup time, but the ui is super slow.
😂 ok. In other words, dont post inflammatory and condescending comments on an open source project. This is on a personal level. 😃
All the best and stay safe,
Walter Monecke
On Sat, May 8, 2021, 16:46 Oliver Dixon @.***> wrote:
It’s not an opinion it’s based of hard data. You can run a standard warehouse test across 20 different manufacturers for example; they’ll give you video results. Look at how broken RN is on some of those manufacturers. Firebase has cloud testing warehouses you can monkey run; you can see tons of inconsistencies and crashes with RN and even native Android dev 😃
Hope this helps you find bugs 🐜
Guys we don’t need comments like the ones left by @cisplRejjak or @ollydixon. React Native is open-source after all and if you are so incompetent to deactivate it / upgrade to the next stable version then the problem might be you. If you bash the RN team or post condescending comments for these types of issues, then I pray for your coworker’s health and sanity.
@Anujmoglix Same here !!
@ecreeth: Thanks for your replying. I have figured it out. It was because of that previously I got issue app crash when generating app bundle in release mode, to deal with it I had to add exclude ‘**/libjscexecutor.so’ to section packagingOptions like bellow. After comment it out, it works if I want to disable hermes.
Any updates?
I have Also Performance issue with the Hermes Enabled on RN 0.60.4 on android devices, it extremely slow on debug build and take 2-3 second on click on a static button, Please Suugest me any Solution, But it works fine on IOS devices
Maybe related https://github.com/facebook/hermes/issues/111#issuecomment-533313121 If you are doing a lot of string concatenate, I suggest using v8 instead of hermes at the moment
Same issues here, updating from RN 0.59 to ~0.60 caused serious performance issues for my project. Disabling hermes helped a bit, but performance was still noticeably degraded, we just had to roll back to 0.59 for now.
iOS builds were not effected
try enable debug mode, there no issue on release build