Skip to content
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

[Java] support speedup inner serialization by using outer generics info #78

Closed
chaokunyang opened this issue May 6, 2023 · 0 comments · Fixed by #79
Closed

[Java] support speedup inner serialization by using outer generics info #78

chaokunyang opened this issue May 6, 2023 · 0 comments · Fixed by #79
Labels

Comments

@chaokunyang
Copy link
Collaborator

Is your feature request related to a problem? Please describe.
For class with nested generics such as:

class Foo {
  List<Integer> intLists;
  Map<String, List<Long>> map;
}

If we push Integer type to ListSerializer and String, List<Long> to MapSerializer, then ListSerializer will know every element is an Integer, there will be no need to query element serializer and write element type every time serializing those elements, thus much space/time efficient.

MapSerializer can use same mechanism. Also when serializing List<Long> value, MapSerializer can push Long to ListSerializer, which make nested list serialization more efficient too.

Java generics is erasured at runtime,List type won't have element type. We need a way to push and propagate those erasured generics along the serialization.

Describe the solution you'd like

  • Using guava TypeToken to extract generics
  • Create an Generics to record generics hierarchy and current generics
  • Create an GenericType to tracking children generics and binding serializer to reduce map loopup cost

Additional context
#70

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant