Add diagnostics for relation cache size (#30999)
* Add diagnostics for relation cache size * Move to extendedDiagnostics * Single method that returns a 3-property object * Fix double-space lint
This commit is contained in:
parent
169e485d90
commit
4420d1083b
|
@ -114,6 +114,11 @@ namespace ts {
|
||||||
getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"),
|
getIdentifierCount: () => sum(host.getSourceFiles(), "identifierCount"),
|
||||||
getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount") + symbolCount,
|
getSymbolCount: () => sum(host.getSourceFiles(), "symbolCount") + symbolCount,
|
||||||
getTypeCount: () => typeCount,
|
getTypeCount: () => typeCount,
|
||||||
|
getRelationCacheSizes: () => ({
|
||||||
|
assignable: assignableRelation.size,
|
||||||
|
identity: identityRelation.size,
|
||||||
|
subtype: subtypeRelation.size,
|
||||||
|
}),
|
||||||
isUndefinedSymbol: symbol => symbol === undefinedSymbol,
|
isUndefinedSymbol: symbol => symbol === undefinedSymbol,
|
||||||
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
|
isArgumentsSymbol: symbol => symbol === argumentsSymbol,
|
||||||
isUnknownSymbol: symbol => symbol === unknownSymbol,
|
isUnknownSymbol: symbol => symbol === unknownSymbol,
|
||||||
|
|
|
@ -927,6 +927,7 @@ namespace ts {
|
||||||
getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(),
|
getIdentifierCount: () => getDiagnosticsProducingTypeChecker().getIdentifierCount(),
|
||||||
getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(),
|
getSymbolCount: () => getDiagnosticsProducingTypeChecker().getSymbolCount(),
|
||||||
getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(),
|
getTypeCount: () => getDiagnosticsProducingTypeChecker().getTypeCount(),
|
||||||
|
getRelationCacheSizes: () => getDiagnosticsProducingTypeChecker().getRelationCacheSizes(),
|
||||||
getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
|
getFileProcessingDiagnostics: () => fileProcessingDiagnostics,
|
||||||
getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
|
getResolvedTypeReferenceDirectives: () => resolvedTypeReferenceDirectives,
|
||||||
isSourceFileFromExternalLibrary,
|
isSourceFileFromExternalLibrary,
|
||||||
|
|
|
@ -2961,6 +2961,7 @@ namespace ts {
|
||||||
/* @internal */ getIdentifierCount(): number;
|
/* @internal */ getIdentifierCount(): number;
|
||||||
/* @internal */ getSymbolCount(): number;
|
/* @internal */ getSymbolCount(): number;
|
||||||
/* @internal */ getTypeCount(): number;
|
/* @internal */ getTypeCount(): number;
|
||||||
|
/* @internal */ getRelationCacheSizes(): { assignable: number, identity: number, subtype: number };
|
||||||
|
|
||||||
/* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection;
|
/* @internal */ getFileProcessingDiagnostics(): DiagnosticCollection;
|
||||||
/* @internal */ getResolvedTypeReferenceDirectives(): Map<ResolvedTypeReferenceDirective | undefined>;
|
/* @internal */ getResolvedTypeReferenceDirectives(): Map<ResolvedTypeReferenceDirective | undefined>;
|
||||||
|
@ -3246,6 +3247,7 @@ namespace ts {
|
||||||
/* @internal */ getIdentifierCount(): number;
|
/* @internal */ getIdentifierCount(): number;
|
||||||
/* @internal */ getSymbolCount(): number;
|
/* @internal */ getSymbolCount(): number;
|
||||||
/* @internal */ getTypeCount(): number;
|
/* @internal */ getTypeCount(): number;
|
||||||
|
/* @internal */ getRelationCacheSizes(): { assignable: number, identity: number, subtype: number };
|
||||||
|
|
||||||
/* @internal */ isArrayType(type: Type): boolean;
|
/* @internal */ isArrayType(type: Type): boolean;
|
||||||
/* @internal */ isTupleType(type: Type): boolean;
|
/* @internal */ isTupleType(type: Type): boolean;
|
||||||
|
|
|
@ -340,6 +340,10 @@ namespace ts {
|
||||||
const checkTime = performance.getDuration("Check");
|
const checkTime = performance.getDuration("Check");
|
||||||
const emitTime = performance.getDuration("Emit");
|
const emitTime = performance.getDuration("Emit");
|
||||||
if (compilerOptions.extendedDiagnostics) {
|
if (compilerOptions.extendedDiagnostics) {
|
||||||
|
const caches = program.getRelationCacheSizes();
|
||||||
|
reportCountStatistic("Assignability cache size", caches.assignable);
|
||||||
|
reportCountStatistic("Identity cache size", caches.identity);
|
||||||
|
reportCountStatistic("Subtype cache size", caches.subtype);
|
||||||
performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration));
|
performance.forEachMeasure((name, duration) => reportTimeStatistic(`${name} time`, duration));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in a new issue