dynamic proxy is basically the core of Java technologies model, AOP model had been implemented. Now we use the Spring EJB3 Hibernate, and most possess a dynamic proxy framework through which, but expression is not obvious when in use.
JDK dynamic proxy itself offer the API, although not prominent due to efficiency or performance, so these frameworks would be to specialized byte code library Code Era Library,
Microsoft Office 2007 Key, Code Era Library, presently you will find CGLib (determined by ASM) and Javassist.
efficiency now than ever before before JDK six.0 version of one.four has significantly enhanced, I lately employed this write-up Why do you think CGLib proxies are faster than JDK Proxies? The check code are around the JDK and CGLib Javassist three dynamic agent properties had been tested and discovered incredible results, not to say that specific database performance bytecode quicker than the JDK, a minimum of Javassist sluggish.
JDK and CGLib check code within the TSS write-up,
Windows 7 Professional X86, I test to Javassist, and JDK are:
public class ProxyPerformanceComparison2 {
public static void main (String [] args) throws Exception {
Callable jdkProxy = (Callable)
Proxy.newProxyInstance (ClassLoader.getSystemClassLoader (), new Class []
Callable.class,
new JdkHandler (new Counter ()));
ProxyFactory f = new ProxyFactory ();
f.setInterfaces (new Class [] Callable.class);
Class c = f.createClass ();
Callable cglibProxy = (Callable) c.newInstance ();
((ProxyObject) cglibProxy). setHandler
(new JavaAssitInterceptor (new Counter ()));
for (int i2 = 0; i2
public Object invoke
(Object self, Technique m, Technique move forward, Object [] args) throws Throwable
return m.invoke (delegate, args);
}
static class Counter implements Callable {
int count = 0;
public Integer call () throws Exception
return count + +;
}
}
check The outcomes are as follows:
JDK six and CGLib cglib-nodep-2.two.jar comparative outcomes:
JDK Proxy: 1,049,937 calls / s
CGLIB: two,820,130 calls / s
If you're utilizing prior versions of cglib,
Office Home And Business Key, quicker performance:
JDK Proxy: one,037,575 calls / s
CGLIB: three,112,727 calls / s
the JDK 6 and JavaAssit three.eleven Test outcomes are as follows:
JDK Proxy: 1,037,575 calls / s
JAVAASSIST: 626,
Microsoft Office 2010 Key,695 calls / s
JAVAASSIST even slower than JDK six, impressive.
even worse is, Hibernate 3.three or later on to make use of JavaAssit, due to the fact the 2 are JBoss, because of it,
Tapstry5 also use JAVAASSIST, Javassist vs. Each Other Bytecode Library Out there
optimize overall performance of each and every action,
Office 2007 Key, little accumulation, will type a significant impact.