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.
-
Rhino vs. BeanShell Performance Comparison (8 messages)
- Posted by: Eugene Ciurana
- Posted on: May 21 2007 09:19 EDT
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:Threaded Messages (8)
- 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 Kirk Pepperdine on May 22 2007 01:34 EDT
- Re: Rhino vs. BeanShell Performance Comparison by George Coller on May 21 2007 12:40 EDT
- Re: Rhino vs. BeanShell Performance Comparison by Jesse Kuhnert on May 21 2007 13:25 EDT
- Clarifying the term compile by James Tikalsky on May 22 2007 11:09 EDT
- Re: Rhino vs. BeanShell Performance Comparison by Jesse Kuhnert on May 21 2007 13:25 EDT
- Re: Rhino vs. BeanShell Performance Comparison by Joe Fouad on May 21 2007 19:31 EDT
-
Interesting[ Go to top ]
- Posted by: Brian O'Neill
- Posted on: May 21 2007 10:48 EDT
- in response to Eugene Ciurana
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. -
Other scripting languages[ Go to top ]
- Posted by: Andrew Yates
- Posted on: May 21 2007 11:49 EDT
- in response to Eugene Ciurana
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). -
Re: Rhino vs. BeanShell Performance Comparison[ Go to top ]
- Posted by: William Louth
- Posted on: May 21 2007 11:55 EDT
- in response to Eugene Ciurana
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 -
Re: Rhino vs. BeanShell Performance Comparison[ Go to top ]
- Posted by: Kirk Pepperdine
- Posted on: May 22 2007 01:34 EDT
- in response to William Louth
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 -
Re: Rhino vs. BeanShell Performance Comparison[ Go to top ]
- Posted by: George Coller
- Posted on: May 21 2007 12:40 EDT
- in response to Eugene Ciurana
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. -
Re: Rhino vs. BeanShell Performance Comparison[ Go to top ]
- Posted by: Jesse Kuhnert
- Posted on: May 21 2007 13:25 EDT
- in response to George Coller
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.htmlCan you optionally compile Rhino or BeanShell like you can Groovy?
-
Clarifying the term compile[ Go to top ]
- Posted by: James Tikalsky
- Posted on: May 22 2007 23:09 EDT
- in response to Jesse Kuhnert
Rhino can be run with compiling turned off / on. (I think there are various levels of this idea implemented)
Just to clarify, Jesse is refering to dynamic compilation, which is the conversion of the JavaScript to Java bytecode as it's interpreted. There is also a JavaScript Compiler, which is more like javac, in that you generate bytecode (.class files) separate from running the code.
By default I think it does compile scripts but you'd have to check to be sure.
http://www.mozilla.org/rhino/opt.html -
Re: Rhino vs. BeanShell Performance Comparison[ Go to top ]
- Posted by: Joe Fouad
- Posted on: May 21 2007 19:31 EDT
- in response to Eugene Ciurana
i like the beanshell syntax but as i use idea i prefer rhino as idea gives me a superb code completion and syntax analysis