I performed a simple benchmark with interpreted and pre-compiled
scripts in Rhino, using the Rhino API (1.7R2) and using javax.script
(Java SE 6b18), evaluating a simple arithmetic expression "1+1". I
was expecting similar performance between the two. I was surprised to
see that javax.script calls to a simple eval() call were taking an
order of magnitude longer than evaluating the same expression using
the Rhino API direct (pre-compiled vs. pre-compiled).
So, would this be expected or is it more likely I've done something
horribly wrong in my calls through javax.script? Perhaps the version
of Rhino that ships w. the JRE is older and slower?
Thanks in advance.
Check this blog post out.
He did some bench testing with some solutions.
> Check this blog post out.
Thanks for pointing me to this. I made sure in my testing that I was
reusing the script engine. I can only imagine how much slower it would
be if I did otherwise. Based on my testing, I've concluded that if
performance is critical—and it is in my case—the Rhino API should used
directly rather than using javax.script.