@Test public void testByteBuddyClassCreation() throws Exception { Class<?> type = trivialClassCreationBenchmark.benchmarkByteBuddy(); assertThat(type, not(CoreMatchers.<Class<?>>is(TrivialClassCreationBenchmark.BASE_CLASS))); assertThat(type.getSuperclass(), CoreMatchers.<Class<?>>is(TrivialClassCreationBenchmark.BASE_CLASS)); assertThat(trivialClassCreationBenchmark.benchmarkByteBuddy(), not(CoreMatchers.<Class<?>>is(type))); }
@Benchmark public Class<?> benchmarkByteBuddy() { return new ByteBuddy() .with(TypeValidation.DISABLED) .ignore(any()) .subclass(baseClass) .make() .load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION) .getLoaded(); }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkByteBuddy() { return new ByteBuddy() .with(TypeValidation.DISABLED) .ignore(any()) .subclass(baseClass) .make() .load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION) .getLoaded(); } }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkByteBuddy() { return new ByteBuddy() .with(TypeValidation.DISABLED) .ignore(any()) .subclass(baseClass) .make() .load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION) .getLoaded(); }  }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkByteBuddy() { return new ByteBuddy() .with(TypeValidation.DISABLED) .ignore(any()) .subclass(baseClass) .make() .load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION) .getLoaded(); }  @Benchmark Class<?> baseline(); @Benchmark Class<?> benchmarkByteBuddy(); @Benchmark Class<?> benchmarkCglib(); @Benchmark Class<?> benchmarkJavassist(); @Benchmark @SuppressWarnings("deprecation") Class<?> benchmarkJdkProxy(); }
TrivialClassCreationBenchmark { @Benchmark public Class<?> benchmarkByteBuddy() { return new ByteBuddy() .with(TypeValidation.DISABLED) .ignore(any()) .subclass(baseClass) .make() .load(newClassLoader(), ClassLoadingStrategy.Default.INJECTION) .getLoaded(); }  @Benchmark Class<?> baseline(); @Benchmark Class<?> benchmarkByteBuddy(); @Benchmark Class<?> benchmarkCglib(); @Benchmark Class<?> benchmarkJavassist(); @Benchmark @SuppressWarnings("deprecation") Class<?> benchmarkJdkProxy(); static final Class<?> BASE_CLASS; }