Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tsc/internal/checker/checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -21052,7 +21052,7 @@ func (c *Checker) createInstantiatedSymbolTable(symbols []*ast.Symbol, m *TypeMa
if len(symbols) == 0 {
return nil
}
result := make(ast.SymbolTable)
result := make(ast.SymbolTable, len(symbols))
for _, symbol := range symbols {
result[symbol.Name] = c.instantiateSymbol(symbol, m)
Comment on lines +21055 to 21057

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they always unique? Or does this overallocate because dupes are common? I assume not.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like they're always unique - every nonempty call had len(symbols) == len(result).

I ran this on the go test suite + vscode:

Workload Total calls Nonempty tables Calls with duplicates Most common nonempty hint → length
VS Code main project 211,390 14,668 0 2 → 2 (72.1%)
Go compiler suite 538,031 22,045 0 2 → 2 (73.8%)
}
Expand Down