Skip to content

SchemaGeneratorHelper that does NOT put in an entry for defaulted values #3755

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

Merged
merged 4 commits into from
Nov 26, 2024

Conversation

bbakerman
Copy link
Member

If the code registry DFF value is the default then there is no need for a map entry since the lookup will default to the default

…Helper that does NOT put in an entry for defaulted values
…Helper that does NOT put in an entry for defaulted values- DFF tweaked

default DataFetcher<T> getViaField(GraphQLFieldDefinition fieldDefinition) {
return null;
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DataFetcherFactoryEnvironment is a "parameter" object that ONLYT wraps a GraphQLFieldDefinition

It was put in place for "future expansion reasons" but we never expanded it and never had to. So this one as a bad bet since we have to make a new object just to pass 1 object we already have

This method undoes that and says we can lookup via just the GraphQLFieldDefinition object

// if the dataFetcherFactory is empty, then it must have been the code registry default one
// and hence we don't need to make a "map entry" in the code registry since it will be defaulted
// anyway
dataFetcherFactory.ifPresent(fetcherFactory -> buildCtx.getCodeRegistry().dataFetcher(coordinates, fetcherFactory));
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the saving - we are not holding a DF per field when it would be defaulted in the code registry.

If we had 90% DFs that are the default - eg PropertyDataFetchers - then we save all those entries in memory

@bbakerman bbakerman merged commit 886d745 into singeton_property_data_fetcher Nov 26, 2024
@dondonz dondonz added this to the 23.x breaking changes milestone Nov 26, 2024
@dondonz dondonz deleted the no_df_if_codereg_default branch November 27, 2024 22:53
@dondonz dondonz added the performance work that is primarily targeted as performance improvements label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance work that is primarily targeted as performance improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants