public class ClassByExtensionBenchmark extends Object
This benchmark dynamically creates a subclass of ExampleClass which overrides all methods to invoke the
direct super class's implementation. The benchmark furthermore creates an instance of this class since some
code generation frameworks rely on this property. Because this benchmark requires the creation of a subclass,
the JDK proxy is not included in this benchmark.
Note that this class defines all values that are accessed by benchmark methods as instance fields. This way, the JIT compiler's capability of constant folding is limited in order to produce more comparable test results.
| Modifier and Type | Class and Description |
|---|---|
static class |
ClassByExtensionBenchmark.ByteBuddyAccessInterceptor
Instead of using the
SuperMethodCall implementation, we are creating
delegate methods that allow the invocation of the original code. |
static class |
ClassByExtensionBenchmark.ByteBuddyPrefixInterceptor
An interceptor that is invoked prior to a super method call.
|
static class |
ClassByExtensionBenchmark.ByteBuddyProxyInterceptor
Instead of using the
SuperMethodCall implementation, we are using
a delegate in order to emulate the interception approach of other instrumentation libraries. |
| Modifier and Type | Field and Description |
|---|---|
static Class<? extends ExampleClass> |
BASE_CLASS
The base class to be subclassed in all benchmarks.
|
| Constructor and Description |
|---|
ClassByExtensionBenchmark() |
| Modifier and Type | Method and Description |
|---|---|
ExampleClass |
baseline()
Creates a baseline for the benchmark.
|
ExampleClass |
benchmarkByteBuddySpecialized()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithAccessor()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithAccessorAndReusedDelegator()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithAccessorAndReusedDelegatorWithTypePool()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithAccessorWithTypePool()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithPrefix()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithPrefixAndReusedDelegator()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithPrefixAndReusedDelegatorWithTypePool()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithPrefixWithTypePool()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithProxy()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithProxyAndReusedDelegator()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithProxyAndReusedDelegatorWithTypePool()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkByteBuddyWithProxyWithTypePool()
Performs a benchmark of a class extension using Byte Buddy.
|
ExampleClass |
benchmarkCglib()
Performs a benchmark of a class extension using cglib.
|
ExampleClass |
benchmarkJavassist()
Performs a benchmark of a class extension using javassist proxies.
|
void |
setup()
A setup method to create precomputed delegator.
|
public static final Class<? extends ExampleClass> BASE_CLASS
public void setup()
public ExampleClass baseline()
public ExampleClass benchmarkByteBuddyWithProxy() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithProxyAndReusedDelegator() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithProxyWithTypePool() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithProxyAndReusedDelegatorWithTypePool() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithAccessor() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithAccessorAndReusedDelegator() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithAccessorWithTypePool() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithAccessorAndReusedDelegatorWithTypePool() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithPrefix() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithPrefixAndReusedDelegator() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithPrefixWithTypePool() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddyWithPrefixAndReusedDelegatorWithTypePool() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkByteBuddySpecialized() throws Exception
Exception - If the invocation causes an exception.public ExampleClass benchmarkCglib()
public ExampleClass benchmarkJavassist() throws Exception
Exception - If the invocation causes an exception.Copyright © 2014–2023. All rights reserved.