Skip to content

Commit b281007

Browse files
committed
Revert "OK, time to see if Map is the perf issue"
This reverts commit 73cb712.
1 parent 73cb712 commit b281007

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/compiler/checker.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,7 @@ namespace ts {
563563
const flowLoopNodes: FlowNode[] = [];
564564
const flowLoopKeys: string[] = [];
565565
const flowLoopTypes: Type[][] = [];
566-
let sharedFlowTypes: MapLike<FlowType> = createDictionaryObject();
566+
const sharedFlowTypes: Map<FlowType> = createMap();
567567
const potentialThisCollisions: Node[] = [];
568568
const potentialNewTargetCollisions: Node[] = [];
569569
const awaitedTypeStack: number[] = [];
@@ -16063,7 +16063,7 @@ namespace ts {
1606316063
// some getFlowTypeOfReference invocation. A node is considered shared when it is the
1606416064
// antecedent of more than one node.
1606516065
const nodeId = `${refKey}@${getFlowNodeId(flow)}`;
16066-
const result = sharedFlowTypes[nodeId];
16066+
const result = sharedFlowTypes.get(nodeId);
1606716067
if (result) {
1606816068
flowDepth--;
1606916069
return result;
@@ -16132,7 +16132,7 @@ namespace ts {
1613216132
if (flags & FlowFlags.Shared && !isIncomplete(type)) {
1613316133
// Record visited node and the associated type in the cache.
1613416134
const flowId = `${refKey}@${getFlowNodeId(flow)}`;
16135-
sharedFlowTypes[flowId] = type;
16135+
sharedFlowTypes.set(flowId, type);
1613616136
}
1613716137
flowDepth--;
1613816138
return type;
@@ -28956,7 +28956,7 @@ namespace ts {
2895628956
if (skipTypeChecking(node, compilerOptions)) {
2895728957
return;
2895828958
}
28959-
sharedFlowTypes = createDictionaryObject(); // We clear this each time we start checking a file so memory usage doesn't grow too much due to flow result caching - we can't really fully clear at any smaller bounds (just erase subsets, if we wanted to track them)
28959+
sharedFlowTypes.clear(); // We clear this each time we start checking a file so memory usage doesn't grow too much due to flow result caching - we can't really fully clear at any smaller bounds (just erase subsets, if we wanted to track them)
2896028960

2896128961
// Grammar checking
2896228962
checkGrammarSourceFile(node);

src/compiler/core.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ namespace ts {
7272
export const emptyArray: never[] = [] as never[];
7373

7474
/** Create a MapLike with good performance. */
75-
export function createDictionaryObject<T>(): MapLike<T> {
75+
function createDictionaryObject<T>(): MapLike<T> {
7676
const map = Object.create(/*prototype*/ null); // tslint:disable-line:no-null-keyword
7777

7878
// Using 'delete' on an object causes V8 to put the object in dictionary mode.

0 commit comments

Comments
 (0)