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

Improve performance by not building schema AST over and over #2073

Merged
merged 2 commits into from Jul 3, 2019
Merged

Improve performance by not building schema AST over and over #2073

merged 2 commits into from Jul 3, 2019

Conversation

mvestergaard
Copy link
Contributor

@mvestergaard mvestergaard commented Jun 27, 2019

Each plugin being executed was generating an AST of the schema over and over again, which was especially painful when using near-operations-file.

With this change the AST is built early, and only rebuilt in situations where it isn't passed to the plugin for whatever reason, or a plugin changes the schema.

In my project it decreased execution time from 10s to 4s (250%)

Before
image

After
image

There's probably still more that could be done, but this takes care of the worst bits

Addresses the performance issues mentioned on #2069

@mvestergaard
Copy link
Contributor Author

mvestergaard commented Jun 27, 2019

Another obvious speed improvement, is to make the prettier formatting optional. In the flamegraph above, after these changes, prettier makes up 40-50%

Here's a flamegraph with prettier removed
image

It brought execution time in my scenario down to 2.5 seconds (another 160%, or 400% total improvement)

@dotansimha
Copy link
Owner

WOW, that's super interesting. Thank you so much for your efforts!
And you are right, the near-operation-file (and presets in general) is still in experiments. Thank you so much for helping us improving this.

@dotansimha dotansimha merged commit 3af668a into dotansimha:master Jul 3, 2019
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.

None yet

2 participants