[DRAFT] Add MinimalGenerics and allow users to set a GenericsStrategy#879
Open
[DRAFT] Add MinimalGenerics and allow users to set a GenericsStrategy#879
MinimalGenerics and allow users to set a GenericsStrategy#879Conversation
MinimalGenerics and allow users to set a GenericStrategyMinimalGenerics and allow users to set a GenericsStrategy
1c841e9 to
b3a6dfd
Compare
# Conflicts: # src/com/esotericsoftware/kryo/util/DefaultGenerics.java
Member
|
Ideally full generics would be efficient and not have bugs for edge cases (at least #864 is resolved). If the performance overhead can't be improved then I'm fine having a |
Member
|
BTW I got here from the V6 ideas page. All the other ideas sound good! |
# Conflicts: # src/com/esotericsoftware/kryo/util/DefaultGenerics.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We currently support wo strategies for generics:
DefaultGenericsandNoGenerics.The former is enabled by default, but was responsible for most of the bugs found in Kryo 5 and incurs some performance overhead. Users can currently opt-out of generics optimization by setting
Kryo.setOptimizeGenerics(false). Internally, this flag sets the generic strategy toNoGenerics.This PR introduces a third strategy called
MinimalGenericsthat only processes generic type information, but does not attempt to resolve type variables. This makes sense because the type variable logic is quite involved, still has edge-case issues (e.g. #864), and causes most of the performance overhead related to generics handling.The new strategy is safer and should theoretically be faster than disabling generics optimizations altogether, because concrete generic types can still be resolved.
CollectionSerializerandMapSerializershould especially benefit from this.TODO