Skip to content
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

Avoid repeating validations on Fragments #2315

Merged
merged 2 commits into from
Jun 27, 2024

Conversation

kyri-petrou
Copy link
Collaborator

One of the pesky things about Fragments is that it's very "easy" to end up repeating doing the same work, especially when it comes to validation. This happens as a field's selection set will contain a fragment, and we end up re-validating the fragment all-over again.

This PR adds caching for fragment validation in a few places in the Validator. Note that we've already been doing this in some other parts.

With these changes, there's ~60% throughput increase for validating fragments based on the introspection query from this very "simple" optimization :)

Copy link
Owner

@ghostdogpr ghostdogpr left a comment

Choose a reason for hiding this comment

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

Brilliant 😄

@kyri-petrou kyri-petrou merged commit 82ce42d into series/2.x Jun 27, 2024
10 checks passed
@kyri-petrou kyri-petrou deleted the cache-field-validation-of-fragments branch June 27, 2024 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants