/** * Javassist is faster than Jdk dynamic proxy by more than 2 times * * <p>Test results: * * <p>Jdk dynamic proxy: 247ms Javassist proxy: 89ms * * <p>Jdk dynamic proxy: 248ms Javassist proxy: 91ms * * <p>Jdk dynamic proxy: 207ms Javassist proxy: 90ms */ @Test public void testPerformance() { long start = System.currentTimeMillis(); // Run 100 million times for (int j = 0; j < 100000000; j++) { remoteRpcCallOfJdk.execute("123"); } System.out.println("Jdk dynamic proxy: " + (System.currentTimeMillis() - start) + "ms"); start = System.currentTimeMillis(); for (int j = 0; j < 100000000; j++) { remoteRpcCallOfJavassist.execute("123"); } System.out.println("Javassist proxy: " + (System.currentTimeMillis() - start) + "ms"); }
@Test public void testProxyExecute() { Integer i = myProxyRpcCall.execute("123"); System.out.println(i); }
@Test public void testRemoteExecuteOfJdk() { Integer i = remoteRpcCallOfJdk.execute("123"); System.out.println(i); }
@Test public void testLocalExecute() { Integer i = localRpcCall.execute("123"); System.out.println(i); }