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

fix: Remove redundant constraints on IntrospectionQuery causing TS perf bottlenecks #26

Merged
merged 4 commits into from
Jan 18, 2024

Conversation

kitten
Copy link
Member

@kitten kitten commented Jan 18, 2024

Resolves #22

Summary

This removes any unnecessary and redundant constraints in IntrospectionQuery, which previously forced TypeScript to recursively check the input IntrospectionQuery data (i.e. the schema data a user gives us) against the constraint type.

This meant that TypeScript was spending a lot of time in recursiveTypeRelatedTo, only to recursively unroll an introspection schema that we were mapping and checking anyway.

Instead, this constraint is now removed and also doesn't affect code paths that run after mapIntrospection has run already.

Set of changes

  • Remove args from IntrospectionField
  • Remove interfaces from IntrospectionObjectType and IntrospectionInterfaceType
  • Change types constraint to readonly any[] in IntrospectionSchema

Copy link

changeset-bot bot commented Jan 18, 2024

🦋 Changeset detected

Latest commit: 0ffc7a9

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kitten kitten merged commit d383684 into main Jan 18, 2024
3 checks passed
@kitten kitten deleted the fix/remove-redundant-constraints branch January 18, 2024 20:23
@github-actions github-actions bot mentioned this pull request Jan 18, 2024
@kitten kitten added this to the Are We Fast Yet? milestone Mar 22, 2024
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.

Extremely slow with 7MB schema and 1m LOC on introspection.ts
2 participants