Hi All,
I am currently in the process of profiling an application that makes
many many calls to .equals() on lazily loaded proxies and noticed that
the code was spending a good chunk of time calling
method.getParameterTypes() in the
org.hibernate.proxy.BasicLazyInitializer.invoke() method. Is there a
particular reason this code is calling method.getParameterTypes().length
rather than just using the length of the args array that was passed into
the method? I changed this in my local copy and the hotspot completely
disapeared from under my profilers radar... I ran the test suite after
making this change and it did not appear to break any proxy related
tests and my app seems to run just fine so I think everything is ok, can
anyone more familiar with the innards of the proxy code verify i'm not
breaking anything here?
attached is a patch if anyones interested
Cheers,
Jason
--- src/org/hibernate/proxy/BasicLazyInitializer.java 2005-07-22
04:32:25.000000000 -0700
+++ src/org/hibernate/proxy/BasicLazyInitializer.java.orig 2005-07-22
04:30:56.000000000 -0700
@@ -46,7 +46,7 @@
protected final Object invoke(Method method, Object[] args, Object
proxy) throws Throwable {
String methodName = method.getName();
- int params = method.getParameterTypes().length;
+ int params = args.length;
if ( params==0 ) {