@Test public void testCglibClassCreation() throws Exception { Class<?> type = trivialClassCreationBenchmark.benchmarkCglib(); assertThat(type, not(CoreMatchers.<Class<?>>is(TrivialClassCreationBenchmark.BASE_CLASS))); assertThat(type.getSuperclass(), CoreMatchers.<Class<?>>is(TrivialClassCreationBenchmark.BASE_CLASS)); assertThat(trivialClassCreationBenchmark.benchmarkCglib(), not(CoreMatchers.<Class<?>>is(type))); }
@Benchmark public Class<?> benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); enhancer.setCallbackType(NoOp.class); return enhancer.createClass(); }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); enhancer.setCallbackType(NoOp.class); return enhancer.createClass(); } }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); enhancer.setCallbackType(NoOp.class); return enhancer.createClass(); }  }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); enhancer.setCallbackType(NoOp.class); return enhancer.createClass(); }  @Benchmark Class<?> baseline(); @Benchmark Class<?> benchmarkByteBuddy(); @Benchmark Class<?> benchmarkCglib(); @Benchmark Class<?> benchmarkJavassist(); @Benchmark @SuppressWarnings("deprecation") Class<?> benchmarkJdkProxy(); }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkCglib() { Enhancer enhancer = new Enhancer(); enhancer.setUseCache(false); enhancer.setClassLoader(newClassLoader()); enhancer.setSuperclass(baseClass); enhancer.setCallbackType(NoOp.class); return enhancer.createClass(); }  @Benchmark Class<?> baseline(); @Benchmark Class<?> benchmarkByteBuddy(); @Benchmark Class<?> benchmarkCglib(); @Benchmark Class<?> benchmarkJavassist(); @Benchmark @SuppressWarnings("deprecation") Class<?> benchmarkJdkProxy(); static final Class<?> BASE_CLASS; }