-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
[WIP] Persist resolutions and program information and reuse it when building program incrementally or during editor #41004
Conversation
cb79ae2
to
36d89be
Compare
2f726c1
to
18035fa
Compare
18035fa
to
d05151a
Compare
aa893c3
to
7e761cd
Compare
073ed19
to
fb609c0
Compare
12ca63c
to
abe3b73
Compare
a0e33af
to
7c202bd
Compare
This is a really interesting idea. What sorts of speed-ups/memory reduction savings have you seen on larger projects? |
…d to a file This ensure --watch and editor behaviour matches with what happens without watch and there is no confusion as well as we are not watching unnecessary things
… enabling persistResolutions)
…ect reference files in the program so editor can use correct program
95eeb32
to
f0db440
Compare
Found this PR again after seeing it on the TypeScript 5.0 roadmap.
I think it'll be extremely significant. Back when I was investigating this for a large monorepo, I saw a 72.21% improvement in one of our team's packages. Details in #40964 Looking forward to some version of this in 5.0. Thanks! |
This PR adds option
persistResolutions
which perists the program and resolutions information into the tsbuildinfo file. This option is meant to also mean that if module is resolved to file, dont watch any of the failed lookup locations for those, and always use that file as resolved file unless that file is deleted. The unresolved modules are still resolved again to see if it can be resolved at time of program creation.This also adds option
cleanPersistedProgram
to remove the persisted program information (without loosing incremental build information) which helps in creating program as if this option was not enabled. So if user changes location of where the resolution needs to be, they can use this option.The main changes are:
oldProgram
asProgramFromBuildInfo
which is built from program information saved in tsbuildinfo. The stored information is partial information needed to make decisions about whether program structure can be completely reused or only module resolutions can be safely used or cannot reuse at all.persistResolutions
is true. Need to be stored with and without--out
option.oldProgram
differ inuseSourceOfProjectReferenceRedirect
, then structure cannot be reused and in case ofpersistentResolution
it means module resolution can be reused.Questions to answer :
persistResolutions
ok. Given we do need to store more information than just resolutions but resolutions are the main things that determine the behavior of if they should be retained or not.cleanPersistedProgram
now useful. It was in the start because when i was experimenting , module name resolution whether failed or succeeded would be re-used so if you did npm install, you would want to run this command to clean up. Now that we still resolve failed lookups or if resolved file is deleted, things should flow more smoothly and just deleting tsbuildinfo file should be ok in that rare case.. The new behaviour works better with editing experience.cleanPersistedProgram
option. Will it be intuitive?cleanPersistedProgram
option to be run and then restart the tsserver to handle the the project updates?