@Test public void testJavassistClassCreation() throws Exception { Class<?> type = trivialClassCreationBenchmark.benchmarkJavassist(); assertThat(type, not(CoreMatchers.<Class<?>>is(TrivialClassCreationBenchmark.BASE_CLASS))); assertThat(type.getSuperclass(), CoreMatchers.<Class<?>>is(TrivialClassCreationBenchmark.BASE_CLASS)); assertThat(trivialClassCreationBenchmark.benchmarkJavassist(), not(CoreMatchers.<Class<?>>is(type))); }
@Benchmark public Class<?> benchmarkJavassist() { ProxyFactory proxyFactory = new ProxyFactory() { protected ClassLoader getClassLoader() { return newClassLoader(); } }; proxyFactory.setUseCache(false); proxyFactory.setUseWriteReplace(false); proxyFactory.setSuperclass(baseClass); proxyFactory.setFilter(new MethodFilter() { public boolean isHandled(Method method) { return false; } }); return proxyFactory.createClass(); }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkJavassist() { ProxyFactory proxyFactory = new ProxyFactory() { protected ClassLoader getClassLoader() { return newClassLoader(); } }; proxyFactory.setUseCache(false); proxyFactory.setUseWriteReplace(false); proxyFactory.setSuperclass(baseClass); proxyFactory.setFilter(new MethodFilter() { public boolean isHandled(Method method) { return false; } }); return proxyFactory.createClass(); } }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkJavassist() { ProxyFactory proxyFactory = new ProxyFactory() { protected ClassLoader getClassLoader() { return newClassLoader(); } }; proxyFactory.setUseCache(false); proxyFactory.setUseWriteReplace(false); proxyFactory.setSuperclass(baseClass); proxyFactory.setFilter(new MethodFilter() { public boolean isHandled(Method method) { return false; } }); return proxyFactory.createClass(); }  }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkJavassist() { ProxyFactory proxyFactory = new ProxyFactory() { protected ClassLoader getClassLoader() { return newClassLoader(); } }; proxyFactory.setUseCache(false); proxyFactory.setUseWriteReplace(false); proxyFactory.setSuperclass(baseClass); proxyFactory.setFilter(new MethodFilter() { public boolean isHandled(Method method) { return false; } }); return proxyFactory.createClass(); }  @Benchmark Class<?> baseline(); @Benchmark Class<?> benchmarkByteBuddy(); @Benchmark Class<?> benchmarkCglib(); @Benchmark Class<?> benchmarkJavassist(); @Benchmark @SuppressWarnings("deprecation") Class<?> benchmarkJdkProxy(); }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkJavassist() { ProxyFactory proxyFactory = new ProxyFactory() { protected ClassLoader getClassLoader() { return newClassLoader(); } }; proxyFactory.setUseCache(false); proxyFactory.setUseWriteReplace(false); proxyFactory.setSuperclass(baseClass); proxyFactory.setFilter(new MethodFilter() { public boolean isHandled(Method method) { return false; } }); return proxyFactory.createClass(); }  @Benchmark Class<?> baseline(); @Benchmark Class<?> benchmarkByteBuddy(); @Benchmark Class<?> benchmarkCglib(); @Benchmark Class<?> benchmarkJavassist(); @Benchmark @SuppressWarnings("deprecation") Class<?> benchmarkJdkProxy(); static final Class<?> BASE_CLASS; }