-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Skip verifyCompilerOptions
when possible on program updates
#60754
base: main
Are you sure you want to change the base?
Skip verifyCompilerOptions
when possible on program updates
#60754
Conversation
…dentical config files
@typescript-bot perf test |
@andrewbranch Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
startupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
src/compiler/program.ts
Outdated
@@ -2722,6 +2735,14 @@ export function createProgram(rootNamesOrOptions: readonly string[] | CreateProg | |||
filesByName.set(path, filesByName.get(oldFile.path)); | |||
}); | |||
|
|||
if ( | |||
oldOptions.configFile && oldOptions.configFile === options.configFile || | |||
!oldOptions.configFile && !options.configFile && !optionsHaveChanges(oldOptions, options, optionDeclarations) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need to check that the program's file set are the same as well, because a new or deleted file can invalidate/introduce some errors. Maybe it's done elsewhere, but it would be good to add a test for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Early returns above handle that (we wouldn’t be at StructureIsReused.Completely
if that happened)
@typescript-bot pack this |
Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your
and then running There is also a playground for this build and an npm module you can use via |
verifyCompilerOptions
when possible on program updates
const isConfigIdentical = oldOptions.configFile && oldOptions.configFile === options.configFile | ||
|| !oldOptions.configFile && !options.configFile && !optionsHaveChanges(oldOptions, options, optionDeclarations); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to suggest
const isConfigIdentical = oldOptions.configFile && oldOptions.configFile === options.configFile | |
|| !oldOptions.configFile && !options.configFile && !optionsHaveChanges(oldOptions, options, optionDeclarations); | |
// Reuse if both have an identical config file, | |
// or neither have a config but the options have changed. | |
const isConfigIdentical = oldOptions.configFile === options.configFile && ( | |
options.configFile || !optionsHaveChanges(oldOptions, options, optionDeclarations)) |
But now the comment is really explaining what the current code is more clearly doing. That said, when do you end up in a situation where neither has a configFile? Inferred projects?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, possibly—I was also wondering about tsc --watch
without -p
but I honestly don’t know for sure
Related to #60633
Reusing config diagnostics lowers the update time in the linked issue scenario from ~70ms to ~50ms on my M2 Mac.