You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 1, 2019. It is now read-only.
I've recently made a small change to my project and now my build is roughly 3x slower.
I have created a second tsconfig.json file and wanted to make use of the extends feature to inherit from my original config file. Apparently this has an influence on how TypeScript resolves the baseUrl in compilerOptions. With a single tsconfig.json a simple . becomes C:/Path/To/Project, when using extends however TypeScript converts it to lowercase c:/path/to/project.
While this inconsistency could be considered an issue on the TypeScript side it's still technically correct since I'm running this on a case insensitive file system.
Now as mentioned in the beginning, after this change my build still works exactly the same it just takes a lot longer. I've pinpointed the cause for this in updateFile() of checker/runtime.ts:332:
const file = files.get(fileName);
if (file) {
let updated = false;
if (file.fileName !== fileName) {
if (caseInsensitive) {
file.fileName = fileName; // use most recent name for case-sensitive file systems
updated = true;
} else {
// omitted for brevity
}
}
if (file.text !== text) { updated = updated || true; }
if (!updated) {
return;
}
projectVersion++;
file.version++;
file.text = text;
file.snapshot = compiler.ScriptSnapshot.fromString(text);
}
If the file can be found in the internal case insensitive map but the file names don't exactly match (different case) and it is a case insensitive file system, the file is considered "updated" and the file as well as project version is increased.
This increased project version results in the fast check in TypeScript's synchronizeHostData() to fail many more times that it would have to which causes it to repeatedly do things even though nothing actually changed.
Removing this one line updated = true actually fixes my performance issue. However, I was a bit hesitant to open a PR because I'm not sure if there is a scenario that actually requires the versions to be incremented in that case.
The text was updated successfully, but these errors were encountered:
I've recently made a small change to my project and now my build is roughly 3x slower.
I have created a second
tsconfig.json
file and wanted to make use of theextends
feature to inherit from my original config file. Apparently this has an influence on how TypeScript resolves thebaseUrl
incompilerOptions
. With a singletsconfig.json
a simple.
becomesC:/Path/To/Project
, when usingextends
however TypeScript converts it to lowercasec:/path/to/project
.While this inconsistency could be considered an issue on the TypeScript side it's still technically correct since I'm running this on a case insensitive file system.
Now as mentioned in the beginning, after this change my build still works exactly the same it just takes a lot longer. I've pinpointed the cause for this in
updateFile()
ofchecker/runtime.ts:332
:If the file can be found in the internal case insensitive map but the file names don't exactly match (different case) and it is a case insensitive file system, the file is considered "updated" and the file as well as project version is increased.
This increased project version results in the fast check in TypeScript's
synchronizeHostData()
to fail many more times that it would have to which causes it to repeatedly do things even though nothing actually changed.Removing this one line
updated = true
actually fixes my performance issue. However, I was a bit hesitant to open a PR because I'm not sure if there is a scenario that actually requires the versions to be incremented in that case.The text was updated successfully, but these errors were encountered: