Skip to content

Commit f849917

Browse files
committed
perf: reduce GC pressure by hoisting script target features object
1 parent d0684f7 commit f849917

File tree

2 files changed

+397
-401
lines changed

2 files changed

+397
-401
lines changed

src/compiler/checker.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
addSyntheticLeadingComment,
99
AliasDeclarationNode,
1010
AllAccessorDeclarations,
11+
AllScriptTargetFeatures,
1112
AmbientModuleDeclaration,
1213
and,
1314
AnonymousType,
@@ -344,7 +345,6 @@ import {
344345
getResolveJsonModule,
345346
getRestParameterElementType,
346347
getRootDeclaration,
347-
getScriptTargetFeatures,
348348
getSelectedEffectiveModifierFlags,
349349
getSemanticJsxChildren,
350350
getSetAccessorValueParameter,
@@ -32377,8 +32377,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3237732377

3237832378
function getSuggestedLibForNonExistentName(name: __String | Identifier) {
3237932379
const missingName = diagnosticName(name);
32380-
const allFeatures = getScriptTargetFeatures();
32381-
const typeFeatures = allFeatures.get(missingName);
32380+
const typeFeatures = AllScriptTargetFeatures.get(missingName);
3238232381
return typeFeatures && firstIterator(typeFeatures.keys());
3238332382
}
3238432383

@@ -32388,8 +32387,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
3238832387
return undefined;
3238932388
}
3239032389
const containingTypeName = symbolName(container);
32391-
const allFeatures = getScriptTargetFeatures();
32392-
const typeFeatures = allFeatures.get(containingTypeName);
32390+
const typeFeatures = AllScriptTargetFeatures.get(containingTypeName);
3239332391
if (typeFeatures) {
3239432392
for (const [libTarget, featuresOfType] of typeFeatures) {
3239532393
if (contains(featuresOfType, missingProperty)) {

0 commit comments

Comments
 (0)