You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
That is its the actual fetched object and if the fetched result is a graphql.execution.DataFetcherResult then the errors and local context are placed into the wrapper object.
The thing is this is never actually used by the graphql engine for anything other than the private final Object fetchedValue aspect, eg the unboxed fetched value.
So we could avoid a MAJOR allocation here by NOT wrapping values in a graphql.execution.FetchedValue
Every value that comes via a DataFetcher is wrapped today in a graphql.execution.FetchedValue
This means we do an allocation for every value returned which is mostly pointless.
The wrinkle here in getting ride of this this
ExecutionStrategy has a protected DUCK type method
It is either a promise or a materialised FetchedValue here.
graphql.execution.instrumentation.parameters.InstrumentationFieldCompleteParameters#getFetchedValue returns an object that is assumed to be a FetchedValue
public Object getFetchedValue() {
return fetchedValue;
}
This is actually declared as Object but it was always FetchedValue so nominally it might have the errors and localcontext on it. This Instrumentation is called BEFORE we complete a value.
IF we got rid of FetchedValue then this be a semantic breaking change to the Instrumentation - ie its not an API breaking change but it is a semantic one.
Brads view
I think that the fetchField method change is ok - we dont really want ExecutionStrategy to be API even if it is.
I think the Instrumentation semantic breaking change is more impactful BUT if we can avoid a double allocation for EVERY value we ever return then I think this will be worth the trade off
Hello, this issue has been inactive for 60 days, so we're marking it as stale. If you would like to continue this discussion, please comment within the next 30 days or we'll close the issue.
Activity
github-actions commentedon Jun 21, 2025
Hello, this issue has been inactive for 60 days, so we're marking it as stale. If you would like to continue this discussion, please comment within the next 30 days or we'll close the issue.
dondonz commentedon Aug 2, 2025
@bbakerman let me know if something in your proposal is not already completed in your merged PR
bbakerman commentedon Aug 3, 2025
This is done in a way - not quite as described - but good enough - FetchedValue still exists but only some times