react-native-v8 icon indicating copy to clipboard operation
react-native-v8 copied to clipboard

Enable Jit

Open Alaa-Ben opened this issue 4 years ago • 4 comments

Hi, I read the following line in the README:

Currently JIT is disabled except on arm64-v8a.

I have a few questions about this. Isn't JIT supposed to improve performance ? Why is it disabled on other architectures ? Can I enable it for all ? if so, how ?

Thank you in advance for your answers !

Alaa-Ben avatar Sep 30 '19 10:09 Alaa-Ben

@Alaa-Ben That is for CPU & memory constraint since JIT would consume more CPU & memory. If you need to enable JIT, you could have a custom build of v8-android. Disable lite mode at https://github.com/Kudo/v8-android-buildscripts/blob/master/scripts/build.sh#L73

Kudo avatar Oct 02 '19 02:10 Kudo

@Kudo You believe the performance gain from enabling JIT isn't worth the additional CPU & memory consumption ? Also, what am I supposed to do to add my custom build in React Native ? I think I should replace url("$rootDir/../node_modules/v8-android-nointl/dist") in the project build.gradle with my custom url, but no sure. Thank you in advance for your answers !

Alaa-Ben avatar Oct 02 '19 06:10 Alaa-Ben

@Alaa-Ben

You believe the performance gain from enabling JIT isn't worth the additional CPU & memory consumption ?

That is what I know, but I have no time to do some benchmark for CPU & memory comparison. In real world scenarios, things will get more complicated. The CPU & memory on your user's Android device varies. And application code varies, I mean some applications rely JS computing heavily but some are not. To keep balanced between performance and resource constraints, to disable JIT is my current thought.

You could check V8's lite mode introduction for more details. https://v8.dev/blog/v8-lite

Also, what am I supposed to do to add my custom build in React Native ? I think I should replace url("$rootDir/../node_modules/v8-android-nointl/dist") in the project build.gradle with my custom url, but no sure.

Yes, you only need to modify the url("$rootDir/../node_modules/v8-android-nointl/dist") path to your custom V8.

Kudo avatar Oct 02 '19 09:10 Kudo

You can find JIT enabled release here /GoodDollar/v8-android-buildscripts you can download the artifacts from circle ci https://circleci.com/gh/GoodDollar/v8-android-buildscripts/6#artifacts/containers/0

I can confirm that running javascript crypto algorithms is order of magnitude faster with JIT bundled JSC runs at about 4 seconds v8 without JIT also about 4 seconds latest JSC runs at 1.8 v8 with JIT 0.22

sirpy avatar Jan 12 '20 12:01 sirpy