-
Notifications
You must be signed in to change notification settings - Fork 538
Performance improvement caching validation #474
Comments
@jamesmoriarty GraphQL validate functionality was designed with a pretty similar case in mind:
Moreover you can optimise it a little bit more by hashing query string before parsing it to AST. |
Thanks @IvanGoncharov. I really appreciate the response. Is this a feature the maintainers would be interested in merging? If so is there any guidance on how the maintainers would like it implemented?
|
Fixed in master. |
@IvanGoncharov Is the proposal for validationCache accepted? I looking to do a similar kind of optimization for improving GraphQL performance |
I'm currently using GraphQL to transform large documents and I've noticed a significant amount of time in validate. https://github.com/graphql/express-graphql/blob/master/src/index.js#L254
The time spent on the first request:
If I cache the result of validate. The time spent on the second request:
As far as I can tell the schema is static, the query is the same with different arguments, and the validation rules are the same.
The change looks something like:
As it's currently stateless, I'm trying to understand the trade-offs caching the result. I would appreciate any input from the contributors / maintainers. Basically, is this a terrible idea?
The text was updated successfully, but these errors were encountered: