Skip to content

Commit

Permalink
Revert "OK, time to see if Map is the perf issue"
Browse files Browse the repository at this point in the history
This reverts commit 73cb712.
  • Loading branch information
weswigham committed Apr 18, 2019
1 parent 73cb712 commit b281007
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/compiler/checker.ts
Expand Up @@ -563,7 +563,7 @@ namespace ts {
const flowLoopNodes: FlowNode[] = [];
const flowLoopKeys: string[] = [];
const flowLoopTypes: Type[][] = [];
let sharedFlowTypes: MapLike<FlowType> = createDictionaryObject();
const sharedFlowTypes: Map<FlowType> = createMap();
const potentialThisCollisions: Node[] = [];
const potentialNewTargetCollisions: Node[] = [];
const awaitedTypeStack: number[] = [];
Expand Down Expand Up @@ -16063,7 +16063,7 @@ namespace ts {
// some getFlowTypeOfReference invocation. A node is considered shared when it is the
// antecedent of more than one node.
const nodeId = `${refKey}@${getFlowNodeId(flow)}`;
const result = sharedFlowTypes[nodeId];
const result = sharedFlowTypes.get(nodeId);
if (result) {
flowDepth--;
return result;
Expand Down Expand Up @@ -16132,7 +16132,7 @@ namespace ts {
if (flags & FlowFlags.Shared && !isIncomplete(type)) {
// Record visited node and the associated type in the cache.
const flowId = `${refKey}@${getFlowNodeId(flow)}`;
sharedFlowTypes[flowId] = type;
sharedFlowTypes.set(flowId, type);
}
flowDepth--;
return type;
Expand Down Expand Up @@ -28956,7 +28956,7 @@ namespace ts {
if (skipTypeChecking(node, compilerOptions)) {
return;
}
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)
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)

// Grammar checking
checkGrammarSourceFile(node);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/core.ts
Expand Up @@ -72,7 +72,7 @@ namespace ts {
export const emptyArray: never[] = [] as never[];

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

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

0 comments on commit b281007

Please sign in to comment.