WIP - Bytecode based data fetchers #2984
Closed
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.
This PR is was inspired from some work done on https://github.com/jord1e/graphql-java-asm-datafetcher
While it does not use any of the code, it uses the some of the idea.
That is could you dynamically generate a class that helps you fetch directly via method calls instead of reflection
Method.invoke()callsThis uses JavaAssist to generate a peer class for each source class.
The generated class looks much like this
Calling a method directly is 1.7 times after than use the same
method.invoke. That sounds like a lot however its very quick so in the schema of all graphql processing its not a lot.However we do get some improvements in object heavy benchmarks like the introspection one
vs master
This needs a few things to be ready.
We would need to shade Java assist - we dont want to expose this out to others.
We need a JVM wide switch to turn this on or off. Like the
graphql.schema.PropertyDataFetcherHelper#setUseSetAccessibleflag we have today.I think we might turn if off in a release and let people opt in and then maybe invert that on another release.