Skip to content

Potentially speed up / lower memory use of getTypeListId #53367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 6 additions & 7 deletions src/compiler/checker.ts
Original file line number Diff line number Diff line change
@@ -15081,7 +15081,7 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
}

function getTypeListId(types: readonly Type[] | undefined) {
let result = "";
let result: string[] | undefined;
if (types) {
const length = types.length;
let i = 0;
@@ -15091,17 +15091,16 @@ export function createTypeChecker(host: TypeCheckerHost): TypeChecker {
while (i + count < length && types[i + count].id === startId + count) {
count++;
}
if (result.length) {
result += ",";
if (count === 1) {
result = append(result, `${startId}`);
}
result += startId;
if (count > 1) {
result += ":" + count;
else {
result = append(result, `${startId}:${count}`);
}
i += count;
}
}
return result;
return result ? result.join(",") : "";
}

function getAliasId(aliasSymbol: Symbol | undefined, aliasTypeArguments: readonly Type[] | undefined) {