Open UserUNP opened 1 year ago
May I know which converter you are using in this case? The slowness comes from the total number of JNI calls.
Could you share the complete code for the performance tuning?
By the way, the official perf test is at JavetPerf. You are welcome taking a look at it.
It's using the JavetProxyConverter
I can't provide you the code right now because I'm using my phone at the moment
JavetProxyConverter is very expensive in a chaining pattern inside a loop. Saving the whole chain to a variable outside the loop is a common performance improvement point.
Why don't JS developers usually realize the slowness in this pattern? That's because V8 JIT optimizes this pattern underlying. However, that chaining pattern involves JNI calls which prevents both JVM and V8 from JIT optimization.
I think you should include some benchmark results for the interop between js and java of javet because there's some confusing trickery going on such as
being about x6 faster than
with
Test
being a java object andsomething()
being a method that does nothing(@BlazeMCworld came up with this test)
Sometimes javet is really slow when it comes to interoperability and sometimes its slightly faster, so I thought I'd ask if you know why