Skip to content

Retriveing singleton property fetchers will not create DataFetcherFactoryEnvironment objects #3942

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bbakerman
Copy link
Member

@bbakerman bbakerman commented Apr 29, 2025

This was always the intention here when we created #3754 to have a singleton property fetcher instance

However we didnt do the factory right and hence DataFetcherFactoryEnvironment are created when they dont need to be

This fixes on of the items found in #3939

Namely why was "graphql.schema.DataFetcherFactoryEnvironment" being 2% of objects allocated

This fixes that

re : #3941

…reate `DataFetcherFactoryEnvironment` objects for simple property fetchers
@bbakerman bbakerman added the performance work that is primarily targeted as performance improvements label Apr 29, 2025
@bbakerman bbakerman requested review from andimarek and dondonz April 29, 2025 13:00
public DataFetcher<Object> get(GraphQLFieldDefinition fieldDefinition) {
return SINGLETON_FETCHER;
}
};
Copy link
Member Author

Choose a reason for hiding this comment

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

because I didnt override the default public DataFetcher<Object> get(GraphQLFieldDefinition fieldDefinition) then it returned null and hence it went to the older more heavy weight object and a DataFetcherFactoryEnvironment needed to be allocated.

This now means that no DataFetcherFactoryEnvironment objects are allocated for property fetchers

Copy link
Member Author

@bbakerman bbakerman Apr 29, 2025

Choose a reason for hiding this comment

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

I cant unit test this - its not observable - but profiling shows it to be working!

Copy link
Contributor

Test Results

  312 files    312 suites   53s ⏱️
3 581 tests 3 576 ✅ 5 💤 0 ❌
3 670 runs  3 665 ✅ 5 💤 0 ❌

Results for commit ade6100.

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.

1 participant