Open jhen0409 opened 1 year ago
Hermes:
LOG Call to test took 154.2415769994259 milliseconds. (native: 109ms)
LOG Call to test took 111.8033449947834 milliseconds. (native: 68ms)
LOG Call to test took 109.039754986763 milliseconds. (native: 66ms)
LOG Call to test took 105.16988199949265 milliseconds. (native: 65ms)
LOG Call to test took 96.47904500365257 milliseconds. (native: 64ms)
LOG Call to test took 94.72220900654793 milliseconds. (native: 64ms)
LOG Call to test took 87.90507000684738 milliseconds. (native: 63ms)
LOG Call to test took 81.62443000078201 milliseconds. (native: 64ms)
LOG Call to test took 87.84830698370934 milliseconds. (native: 64ms)
LOG Call to test took 94.18151798844337 milliseconds. (native: 64ms)
RNV8:
LOG Call to test took 248 milliseconds. (native: 109ms)
LOG Call to test took 153 milliseconds. (native: 77ms)
LOG Call to test took 129 milliseconds. (native: 73ms)
LOG Call to test took 121 milliseconds. (native: 65ms)
LOG Call to test took 125 milliseconds. (native: 73ms)
LOG Call to test took 122 milliseconds. (native: 69ms)
LOG Call to test took 116 milliseconds. (native: 70ms)
LOG Call to test took 117 milliseconds. (native: 64ms)
LOG Call to test took 119 milliseconds. (native: 69ms)
LOG Call to test took 119 milliseconds. (native: 69ms)
Ref: new-arch-test
branch
hi @jhen0409, thanks for the issue with great repro example. originally i thought this was a regression issue of v8-android-jit@11.110.3, but after downgrading to previous v8, the performance is almost the same.
after far as i can tell, it comes from the loop calls: https://github.com/jhen0409/rnv8-issue-179/blob/071f0b053c3f151ac5c9b9a4253ff4e0ec9b6f79/android/app/src/main/java/com/testv8nativebridge/TestModule.java#L33-L35. it might not be a v8 issue but my implementation inside react-native-v8. i tried to remove locks but still not as good as hermes. i'll keep investigate if i could find something to improve.
Hi @Kudo, I've found some issue on RNV8, it is very likely that there is a performance issue on the native bridge.
I've write a demo project here, basically it runs 10 times of native call and do simple loop in native module, it shows some notable differences in Hermes vs RNV8:
Hermes enabled
RNV8 enabled
It's ~80ms vs ~40ms on Release mode.
I found this problem on my project, it caused 20ms ~ 100ms delay on each native bridge call.
Also, I've found it have the same issue with JSC, not sure if this issue can be improved here.