I have a javascript calling a javascript interface many times (around 500 times sometimes), updating the page's UI from it. It sends a couple strings, and casts String result to string: ""+window.INTERFACENAME.function(...)
.
Without calling the function, it takes 43ms, but takes 6 or 7 seconds with the JSInterface call. Why is the JSInterface so slow?
My solution was to implement the same function in Javascript as the Java code. Messy, but it's much faster than calling Java. I suppose if it were required to make many calls to Java, it would be better to make one call with a list of inputs.