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

tsc: watch --build slower than watch without --build #46705

Closed
mastodon0 opened this issue Nov 5, 2021 · 2 comments
Closed

tsc: watch --build slower than watch without --build #46705

mastodon0 opened this issue Nov 5, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@mastodon0
Copy link

Bug Report

πŸ”Ž Search Terms

tsc, watch, --build, performance, tryReuseStructureFromOldProgram

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about watch, --build

⏯ Playground Link

Repo link

πŸ’» Code

n/a

πŸ™ Actual behavior

Watching a project using --build takes longer to compile than omitting the --build option. The difference could be up to multiple seconds, depending on the project size.

Here is the trace for my sample repo running tsc --build tsconfig.json --watch after saving notImported.ts
slow
trace-slow.txt

Here is the trace when running tsc --project tsconfig.json --watch and saving the same file.
fast
trace_fast.txt

The big difference seems to be that --build doesn't run tryReuseStructureFromOldProgram.
I tried to poke around in the code and it seems that the program state gets released during emitBuildInfo

πŸ™‚ Expected behavior

Watching using tsc --build --watch should be able to reuse the last program state to speed up compile times

@andrewbranch
Copy link
Member

Duplicate of #45082, likely also the same thing as #46420

@andrewbranch andrewbranch added the Duplicate An existing issue was already created label Nov 5, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

3 participants