-
Notifications
You must be signed in to change notification settings - Fork 493
Open
Description
Right now when you execute against the schema, it parses the queries each time. We could speed up these executions by either parsing some queries beforehand or caching previously seen queries.
The use-case I have in mind is when you'd like to respond to a webhook or expose a REST API that use your GraphQL resolvers internally, having pre-parsed server-side queries would speed up the operation.
Something like this:
func (s *Schema) ExecDocument(
ctx context.Context,
query *graphql.Document,
operationName string,
variables map[string]interface{},
) *Response {
// ...
}
An alternative to this is lazily caching the parsed query results, when we encounter the same query twice, use the cached result. This would probably need to be bounded by an LRU cache, but I think it'd be a nice addition to schema.Exec(...)
pavelnikolov
Metadata
Metadata
Assignees
Labels
No labels