On Thursday, September 4, 2003, at 11:01 PM, Chris Nokleberg wrote:
Dain Sundstrom wrote:On Monday, September 1, 2003, at 09:45 PM, gianny DAMOUR wrote:It is true that MethodProxy is super fast (I also gave it a try), however - I may be wrong here - the number of hits on the Manageable Objects will not be significant enought to see a true performance improvement.
It really depends on how we implement things. There may be some services that get hit often (especially if you have a monitoring application). Using a MethodProxy is just as easy a using reflections so I will most likely always use it.
FYI, one potential drawback to using MethodProxy is that a new class is
created for each one. There have been reports that the number of classes
can become a problem in certain container/jvm/platform combinations. You
may want to look into using something a little higher-level (we can add
whatever you need).
Chris (CGLIB team)
Cool. I didn't know you were on this list. I really love cglib. It is easy to use and super fast.
For this case we need to do reflective calls on the public methods of a target instance. Right now I just create a MethodProxy for each method we want to call and I keep that proxy in a hash map (BTW do you know of a faster map style data structure available?) by name with a bunch of other information we need for the invocation. If I could generate a single class that for the entire target, I think that would be better. I thinking of something I can use like this:
ReflectiveProxy myReflectiveProxy = ReflectiveProxy.create(myTargetClass);
MethodProxy methodProxy = myReflectiveProxy.getMethodProxy(myTargetMethod);
methodProxy.invoke(instance, args);
I'm not sure this is possible to do this and be fast. I'm concerned about generated code being able locate the correct method to call quickly (quicker than a hash map).
On another issue, since we own the class loader implementation class, is there some interface we can add to have your dynamic classes loaded directly by our classloader instead of a sub classloader?
-dain
