Subj : Performance: How does accessing a method in a Java class work? To : netscape.public.mozilla.jseng From : "Neil Kolban" Date : Tue Oct 14 2003 12:08 pm Folks, I am looking into embedding Rhino ... I want to be able to script access to Java objects. As a test, in my JavaScript, I create a class, and call a member in the class 20,000 times: var myObj = new MyClass(); var i = 1; while (i<20000) { myObj.myMethod("ABC"); i = i + 1; } In Java, I perform the same task: MyClass myObj = new MyClass(); int i = 1; while (i<20000) { myObj.myMethod("ABC"); i = i + 1; } In Java, the loop takes 60 msecs. In JavaScript, the loop takes 500 msecs. So .. my question is, what does JavaScript "do" when it wants to call a method? Does it go through an introspection / reflection each time? Is there some technique I can use to improve the underlying performance? Neil .