Tuesday, March 31, 2009

Comment on: BeanShell, Rhino and Java -- Performance Comparison

These are my comments on an old performance test by Pankaj Kumar on BeanShell, Jython and others (http://www.pankaj-k.net/spubs/articles/beanshell_rhino_and_java_perf_comparison/index.html).

There are some notable problems with the benchmarks reported in above Blog:
1) When a time comparison is done, you chose the best possible implementation of an algorithm in that language. Evidently this is not the case. For instance, in case of BeanShell, ArrayList is used to represent an array of Strings and not a normal array. This introduces additional overheads especially calls to get() method.
2) If you use inbuilt methods to do the sorting: i.e. array.sort() for Jython and java.util.Collection.sort(array) for BeanShell the results are totally different, and it seem to show Jython to be 13 times slower than BeanShell for array if size 1000. Which is bizarre.

In short, I find all such benchmarks as misleading, and should not be used as the mere metric for choosing a particular scripting language, or for that matter any other programming language. And Pankaj does seem to make this comment at the end of his article.

No comments: