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

Parsing Speedup by Adding Source Files via tsconfig #357

Merged
merged 13 commits into from
Aug 30, 2023

Conversation

oshi97
Copy link
Contributor

@oshi97 oshi97 commented Aug 29, 2023

This PR updates our parsing classes to avoid dynamically add source files to the project during initial parsing.
Instead, we specify a path to the user's tsconfig, so that ts-morph can add them all at once on startup.
Originally, I wanted to never dynamically add source files. However, this is still necessary for when we add new files,
at least not without reworking at least a good portion of how we write to file.

This speeds up initial parsing because every time a source file is added to the project (for instance via addSourceFileAtPath like we were doing), ts-morph will recreate the entire typescript compiler Project instance, which is a slow operation.

I update the unit test workflow to split up the studio/studio-plugin tests, and also turn off coverage collection to speed up tests. We can turn it back on when we actually do something with it.
We can also drop down the playwright test timeout now. The performance improvements here help, and also
when we updated the pages dev startup to use the api instead of a spawnSync.

J=SLAP-2909
TEST=manual

my local test-site has speed up to ~6 second start time, down from ~18 seconds

@oshi97 oshi97 force-pushed the dev/add-source-file-upfront branch from ca21166 to 9f752d2 Compare August 29, 2023 18:09
@oshi97 oshi97 changed the title wip Improve Parsing Performance by Adding Source Files Up Front Aug 30, 2023
@oshi97 oshi97 changed the title Improve Parsing Performance by Adding Source Files Up Front Parsing Speedup by Adding Source Files via tsconfig Aug 30, 2023
@oshi97 oshi97 requested a review from a team August 30, 2023 15:31
@oshi97 oshi97 marked this pull request as ready for review August 30, 2023 16:00
@tmeyer2115 tmeyer2115 self-requested a review August 30, 2023 19:56
@oshi97 oshi97 merged commit d7b3262 into main Aug 30, 2023
@oshi97 oshi97 deleted the dev/add-source-file-upfront branch August 30, 2023 20:00
tmeyer2115 added a commit that referenced this pull request Aug 31, 2023
## Changes
- Studio's startup time is now considerably faster. This is due to an
improvement in the logic for parsing Component and Template files.
(#357)
- The Studio Plugin is now a direct, explicit dependency of Studio. That
means users only have to install `@yext/studio`. They don't need to
worry about manually installing `@yext/studio-plugin` as well. (#355)
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