-
Notifications
You must be signed in to change notification settings - Fork 686
DATACMNS-578 - PoC: Speed up instance creation by generating Factory classes with ASM. #98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…es with ASM. Prepare issue branch.
…es with ASM. Introduced BytecodeGeneratingEntityInstantiator which dynamically generates classes to speed up the dynamic instantiation of objects. Since we cannot support every use case with byte code generation we gracefully fallback to the ReflectiveEntityInstantiator. Original pull request: #98.
af4c00a
to
c76b15c
Compare
} | ||
|
||
@SuppressWarnings("unchecked") | ||
private <T> Constructor<T> findAppropriateConstructorForArguments(Class<T> clazz, Object[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that really needed? If no PreferredConstructor
is found we either deal with the case that there are only constructors available that take arguments but none of them has been annotated with @PersistenceConstructor
. This is usually the case if a special converter is registered for that type so that we're never going to instantiate it anyway.
The other aspect is that the non-availability of a preferred constructor results in the argument array being empty so that we can only fallback to instantiating the implicit default constructor anyway. This is very likely to fail (except array instantiations) as the default constructor would've been detected during preferred constructor detection in the first place.
…es with ASM. Cleaned up byte code generation and removed usage of JDK 8 specific types.
…es with ASM. Added support for unboxing of constructor parameters and more robust handling for cases where we cannot generate a custom ObjectInstantiator. In such cases we'll fall back to the ReflectiveEntityInstantiator.
…es with ASM. Removed book-keeping and logging for types which we cannot generate byte code for.
…es with ASM. Refactoring according to code review.
22b0778
to
0ed1dff
Compare
…es with ASM. Introduced BytecodeGeneratingEntityInstantiator which dynamically generates classes to speed up the dynamic instantiation of objects. Since we cannot support every use case with byte code generation we gracefully fallback to the ReflectiveEntityInstantiator. BytecodeGeneratingEntityInstantiator has support for unboxing of constructor parameters and more robust handling for cases where we cannot generate a custom ObjectInstantiator. Original pull request: #98.
Added some JavaDoc where missing. Better variable names and slightly parameter ordering changes. Formatting in the unit tests and reference to the original ticket. Original pull request: #98.
PROOF-OF-CONCEPT please do not merge yet!
Introduced BytecodeGeneratingEntityInstantiator which dynamically generates classes to speed up the dynamic instantiation of objects. Since we cannot support every use case with byte code generation we gracefully fallback to the ReflectiveEntityInstantiator.