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

Optimize optimizer to avoid deep JSON serialization (fix #422) #447

Merged
merged 1 commit into from
May 15, 2022

Conversation

bcherny
Copy link
Owner

@bcherny bcherny commented May 15, 2022

This diff introduces a "peeking" behavior in the optimizer, to look ahead at the types we would have generated for a given AST node, and use that to de-dupe types before emission.

This means our optimizer can now more efficiently de-dupe AST nodes (avoiding general-purpose JSON serialization), significantly improving performance in cases where schemas emit large unions of complex types.

This supersedes the bandaid we were using before, where we tried to "safely" JSON stringify to compare AST nodes. It also supersedes #424, as well as the more complex hashcode-based approach I prototyped in #446.

@bcherny bcherny force-pushed the perf/optimize-optimizer branch from 1bab98d to a1a1db1 Compare May 15, 2022 16:05
@jmikrut
Copy link

jmikrut commented Jun 13, 2022

Hey @bcherny — was this ever released to NPM?

It looks like a new version hasn't been published yet. Let me know if I'm missing something.

Thank you!

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