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

Add SPI for eagerly parsing class models #366

Closed
aguibert opened this issue Nov 25, 2019 · 0 comments · Fixed by #367
Closed

Add SPI for eagerly parsing class models #366

aguibert opened this issue Nov 25, 2019 · 0 comments · Fixed by #367
Assignees

Comments

@aguibert
Copy link
Member

Is your feature request related to a problem? Please describe.
Since GraalVM's native image is becoming popular, the industry is making a push to move more AOT style applications where frameworks figure out as much as they can ahead of time and cache the results for runtime.

In Yasson, we lazily parse class models, which is a very expensive operation. This only needs to be done once, but it could be further improved by doing this parsing ahead of time.

Describe the solution you'd like
Add an SPI hook that receives a number of Class<?> arguments indicating which ClassModels should be parsed upon creation of the Jsonb instance.

For example:

Jsonb jsonb = JsonbBuilder.create(new JsonbConfig()
          .setProperty(YassonProperties.AOT_PARSE, com.foo.MyModel.class, 
                                                   com.foo.OtherModel.class));

Describe alternatives you've considered
One of my colleagues in Quarkus did a POC that involved generating serializers in order to significantly improve performance. We will see how much parsing classes AOT can help, since it would be a lot less code to maintain if we simply parsed classes ahead of time.

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

Successfully merging a pull request may close this issue.

1 participant