Skip to content

Avoid allocating a bool for cached computed names - #65067

Merged
Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:cnnl
Oct 30, 2026
Merged

Jake Bailey (jakebailey) merged 1 commit into
microsoft:mainfrom
jakebailey:cnnl

Conversation

@jakebailey

Copy link
Copy Markdown
Member

I found this during some unrelated work. There's no reason to allocate a bool here and use a pointer when a tristate suffices.

Computed name caching needs three states, but a bool pointer adds a
separate allocation and another pointer for the GC to scan. Use the
existing tristate representation to avoid that overhead.
Copilot AI balanced review requested due to automatic review settings October 30, 2026 21:29
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 30, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the computed-property-name cache change.

No open issues 🎉

What changed in this PR

This PR removes a boolean allocation from the compiler’s computed-property-name cache by replacing a boolean pointer with core.Tristate.

Changes:

  • Represent unknown, present, and absent cached-name states with core.Tristate.
  • Update cache reads and writes to use tristate checks and conversion.
File Description
tsc/​internal/​checker/​types.go Changes the cached hasName field from *bool to core.Tristate.
tsc/​internal/​checker/​checker.go Uses tristate helpers when reading and storing computed-name results.

Review effort: Balanced

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Oct 30, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Oct 30, 2026
@jakebailey Jake Bailey (jakebailey) added the Domain: Performance Reports of unusually slow behavior label Oct 30, 2026
Merged via the queue into microsoft:main with commit 6161772 Oct 30, 2026
34 checks passed
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Oct 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team Domain: Performance Reports of unusually slow behavior For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants