leangen / graphql-spqr

Build a GraphQL service in seconds
Apache License 2.0
1.09k stars 181 forks source link

Add LightOperationExecutor support for parameterless operations #502

Open shalearkane opened 3 months ago

shalearkane commented 3 months ago

LightOperationExecutor is a performance improvement over OperationExecutor for simple queries as it implements LightDataFetcher interface from GraphQL-Java #2953 and yields about 5% performance improvement in simple queries.

LightDataFetcher implementations do not require DataFetchingEnvironment for getting values and are considered cheaper to execute as DFE is not constructed for the query.

This also makes the DataFetchingEnvironment attribute of ResolutionEnvironment private and instead returns it via a getter since now it can either be a materialised object or wrapped in a Supplier. Also, I have removed some of the attributes of ResolutionEnvironment as it required DFE to be materialised.

kaqqao commented 3 months ago

Hi! These are interesting PRs, thanks for this! I'm currently traveling and don't have a computer with me, but I'll have a proper look when I'm back.