Are there any tips & tricks for making rhino perform faster? I’m trying to compress a large js file using uglifyJs in Rhino and it takes more than a minute. Do you have any hints or other alternatives for rhino in java server side space?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
With the JavaScript API over Rhino you can simply compile the script using the
Compilableinterface. For example:However the benefits of this will show up when running several times the script. Basically it reduces the overhead of re-interpret every time. From the
CompiledScriptjavadoc:Anyway I think you should take a look at the Rhino JavaScript Compiler. It “translates JavaScript source into Java class files”.
And there is a V8 Java implementation. Check jav8.