Converting from JFX Webview to Nashorn. Performance trouble
Jenks, Robert
rjenks at ti.com
Fri Oct 24 16:04:06 UTC 2014
After getting back from JavaOne and being excited about Nashorn I decided to try porting our large javascript app to work under Nashorn. Currently we have a JavaFX application with a WebView component where we load our HTML/CSS/Javascript application. In WebView performance has been about half of what we need it to be. The Javascript application is large, very CPU intensive. It does draw to a canvas, but the drawing is very simplistic and infrequent.
I completed the port and have been experimenting with it. So far, I am disappointed with the results. I expected additional startup delays due to the JIT, but even after the application is warmed up and the JIT compilation threads go idle, the application is running about twice as slow as the WebView version. I even tried using Java 9 EA and it did help some, but it’s still no where near as fast.
I suspect that most of the performance advantages Nashorn gives are related to using the Nashorn (Java) canvas implementation. Since our app isn’t hindered by canvas performance, this doesn’t help. Another interesting observation is that Nashorn is using a HUGE amount of heap space. Our app uses about 300-500MB using the WebView approach, but 3GB under Nashorn.
So, unless someone has a suggestion I think I’m going to move on to trying to get V8 running through the Jav8 project. Since our application performs well in Chrome this is about the last option beyond rewriting out app in C or Java.
-Robert
More information about the nashorn-dev
mailing list