My job is to provide a framework which takes sql queries dynamically and pass on the resultset to script. Script will process resultset and return the Lists or HashMap to framework again so that further processing can be done. So from my perspective resultset processing abilities was a winning point.The testing methodology was straightforward: 1. Get Resultset 2. Note start time 3. Process Resultset using Java / Rhino / Beanshell code. 4. Note end time The test results lead toward helping you chose the best between these two scripting languages to better address your own requirements.
News: Rhino vs. BeanShell Performance Comparison
Sachin's Rhino vs. BeanShell analysis is based on his business requirement for procssing small SQL requests with a dynamic language. He chose Rhino and BeanShell out of expediency from this comprehensive list of languages supported by the JVM. He writes:
- Posted by: Eugene Ciurana
- Posted on: May 21 2007 09:19 EDT
- Interesting by Brian O'Neill on May 21 2007 10:48 EDT
- Other scripting languages by Andrew Yates on May 21 2007 11:49 EDT
- Re: Rhino vs. BeanShell Performance Comparison by William Louth on May 21 2007 11:55 EDT
- Re: Rhino vs. BeanShell Performance Comparison by George Coller on May 21 2007 12:40 EDT
- Re: Rhino vs. BeanShell Performance Comparison by Joe Fouad on May 21 2007 19:31 EDT
I use BeanShell in a few projects, but I never considered performance. The script doesn't run long enough for me to care, and if it did, I'd convert it to Java. Sachin's use case is different, of course. One of BeanShell's features is its small runtime footprint. I wonder if this design focus led to it not performing as well as Rhino. What is Rhino's footprint? (silly pun) I wonder too, which scripting environment has a quicker startup time? The JVM itself contributes to startup time, but if the scripting implementation has less code and fewer dependencies, it might start faster.
It probably doesn't matter much but it would be quite nice to see the performance in other JVM scripting languages. I have to say that 99% of the time if I'm writing in one of these scripting languages performance is very low on my list of priorities. I've always put expressiveness, speed of developement & PCUP (potential * up factor) a lot higher. However it is nice to know what the performance of other scripting languages are when performing this kind of operation (especially since the blogger didn't include Groovy which is my current weapon of choice).
The minimum data collection requirements for each test run. 1. The CPU time for each test run. 2. The database access time for each test run. 3. The amount of GC activity. I see the query is executed before the start time is recorded but this does not necessarily mean that the wall clock times do not contain a significant amount of database access time. In accessing 50,000 the response time of java.sql.ResultSet.next() calls will vary significantly as buffers are depleted and refilled with additional round trips to the database. If one takes away the raw database access time as well as the gc time caused by the allocation of objects in accessing the resultset you could be looking at a completely different performance profile. Instead of this: Java 2375 (baseline) Rhino: 5515 (2x) BeanShell: 11406 (6x) We could have this: Java 375 Rhino: 3515 (10x Java) BeanShell: 9406 (30x Java) The question to ask then is "What is this benchmark actually measuring and comparing?". Of course that should only asked after you have first determined is the effort warranted at all (risk analysis). regards, William
I see the query is executed before the start time is recorded but this does not necessarily mean that the wall clock times do not contain a significant amount of database access time.Would you not say that this observation invalidates the entire bench? The problem with "simple" performance benchmarks is that they are often measuring something other than what we want them to be measuring. In this case you need to mock out the database or as William has put it, somehow account for the underlying effects of un-interesting parts of the answer to this overly broad question. Kind regards, Kirk Pepperdine
Can you optionally compile Rhino or BeanShell like you can Groovy? Would this have any effect on performance? Are Rhino and BeanShell scripts interpreted or do they get converted totally to Java byte code? I know Groovy scripts aren't interpreted - they have to be fully loaded and converted to byte code before they run. I'm not trying to promote Groovy over the posting's languages. Just that I've studied Groovy more so that is my JVM-script langauge reference point.
Rhino can be run with compiling turned off / on. (I think there are various levels of this idea implemented) By default I think it does compile scripts but you'd have to check to be sure. http://www.mozilla.org/rhino/opt.html
Can you optionally compile Rhino or BeanShell like you can Groovy?
By default I think it does compile scripts but you'd have to check to be sure.
i like the beanshell syntax but as i use idea i prefer rhino as idea gives me a superb code completion and syntax analysis