Skip to content

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

@chaokunyang

Description

@chaokunyang

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions