react-native-community / jsc-android-buildscripts

Script for building JavaScriptCore for Android (for React Native but not only)
BSD 2-Clause "Simplified" License
1.06k stars 97 forks source link

JSC is very slow when using cryptography #130

Open sirpy opened 4 years ago

sirpy commented 4 years ago

Question

When using javascript based crypto libraries such as hdkey (uses crypto.createHmac) performance is very low generating 10 addresses with hdkey takes about 1.8 seconds with latest JSC. for comparison: bundled JSC around 4 sec react-native-v8 without JIT also around 4 sec ios simulator 100mili react-native-v8 with JIT 200mili

Maybe the jsc-bundle is not really configured for JIT? any other explanation for the slow runtime on JSC?

newyankeecodeshop commented 4 years ago

What version of JSC are you using? Some versions of 241213 had JIT completely turned off.

sirpy commented 4 years ago

i've tried the packaged version with 0.61 and the latest npm jsc-android the packaged version is 4 seconds latest npm is 1.8 seconds where can i see the JIT flag?

Kudo commented 4 years ago

JSC has four tiers of JIT executions. (Reference from https://webkit.org/blog/9329/a-new-bytecode-format-for-javascriptcore/)

For balancing between resource usage and performance, we only enable LLInt and Baseline JIT. If you would like to check the build flags, here it is

sirpy commented 4 years ago

thanks! i'll try these

khoanguyen-yang commented 1 year ago

Hi @Kudo, @sirpy

So if we want to enable all the JITs, we just simply need to set DENABLE_DFG_JIT=ON and DENABLE_FTL_JIT=ON?

sirpy commented 1 year ago

@sirpy I dont recall the results or if I was able to build and use JSC with JIT. We are still using v8, so I guess it still has the best performance