/** * 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 testRemoteExecuteOfJavassist() { Integer i = remoteRpcCallOfJavassist.execute("123"); System.out.println(i); }