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

Improve Union type serialization performance #173

Closed
marcospassos opened this issue Aug 6, 2019 · 1 comment
Closed

Improve Union type serialization performance #173

marcospassos opened this issue Aug 6, 2019 · 1 comment

Comments

@marcospassos
Copy link
Contributor

marcospassos commented Aug 6, 2019

The serialization mechanism currently calls the ReflectData.get().resolveUnion() Method for resolving union schemas. This call represents a huge penalty as it generates the entire schema for the object behind the scenes to get the schema name and find the corresponding index. It's even worse because sometimes it not even possible to generate the schema for the actual value, causing the serialization to fail:

class Foo {
     // The schema for this object cannot be generated, as the type of tricks can be anything.
     // However, for the sake of the serialization, it doesn't matter, as the type has been specified  in the schema
     public Set<?> tricks = new HashSet<>();
}

This issue can be resolved by checking the set of union schema using the class name instead of using ReflectData.get().resolveUnion(). There is already a snippet in the code that does exactly this, but is currently disabled.

@cowtowncoder cowtowncoder changed the title Union serialization performance Improve Union type serialization performance Aug 15, 2019
@marcospassos
Copy link
Contributor Author

Fixed

@cowtowncoder cowtowncoder added this to the 2.10.0.pr2 milestone Aug 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants