Java 8 introduces Nashorn, fully compliant JS engine and 3-5 times faster than Rhino: http://blog.credera.com/technology-insights/java/java-8-part-2-nashorn/
Most of the time spent processing a page is in the JS execution. Any plans to move over to Nashorn?
I'd like to evaluate Nashorn too but:
- I think that most of the "lost time" is currently lost in HtmlUnit, not in Rhino
- I fear that we would have to patch Nashorn as we need to patch Rhino to fulfil HtmlUnit's needs
- afaik Nashorn suffers from the same problem than Rhino in compiled mode (what HtmlUnit doesn't use): the 64k limit for class generation. This is a big problem when you can't control the size of the js file you have to handle
- Nashorn requires Java 8 and it will take time before we force our users to upgrade
- last but not least, time is short and I think that other issues have an higher priority
If the 64K problem is with respect to method size limit, it looks like it should not be an issue according to this email: http://mail.openjdk.java.net/pipermail/nashorn-dev/2014-January/002710.html
There could be a fallback on Rhino/htmlunit-core-js for backwards compatibility.
I fully understand the time and priority aspect.
Hi together!
Instead of using one of the mentioned javascript engines i would suggest to use googles V8 engine. There are very good java v8 bindings https://github.com/eclipsesource/j2v8 . Yes you maybe have to install v8 natively, but it would be a real improvement in performance and functionallity. I liked htmlUnit very much but todays times require good javascript support for testing and crawling websites. That's the cause many people i know are migrating from htmlunit to selenium with phantomJS where you've very good javascript support because of the headless webkit implementation.
It also would save much work. As you can see in the issue tracker here: 80% of all issues are related to javascript problems or lack of good javascript support.
Last edit: Patrick Huetter 2015-11-24
@Patrick: I fear that you don't make the distinction between JavaScript engine and the implemenation of everything that is related to the context of the execution. Most objects you deal with within a script (related to the DOM for instance) are not part of the JavaScript engine. The limitations/problems of HtmlUnit are very rarely related to the JavaScript engine.