Skip to content

Batch allocations of common checker types - #64793

Merged
Jake Bailey (jakebailey) merged 1 commit into
jakebailey/mem/compact-type-headersfrom
jakebailey/mem/batched-type-allocs
Oct 14, 2026
Merged

Jake Bailey (jakebailey) merged 1 commit into
jakebailey/mem/compact-type-headersfrom
jakebailey/mem/batched-type-allocs

Conversation

@jakebailey

Copy link
Copy Markdown
Member

Common type representations create many small heap objects during checking.

  • Uses the existing typed arenas for frequently allocated type records, reducing small-object allocation overhead.
  • Blocks remain independently collectible rather than giving every type the lifetime of the entire checker.

Part of the memory optimization stack summarized in #64734.

Replaces #64776, which GitHub closed as merged when the stack was reordered.

Common type representations create many small heap objects during
checking, adding allocator and GC bookkeeping costs.

Use the existing bounded typed arenas for frequently allocated types.
Unlike an arena that owns the entire graph, old blocks can still be
reclaimed when no live type references them.

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

The allocation changes are localized and preserve type initialization, tagging, and block-level lifetime behavior.

0 open findings

What changed in this PR

Moves frequently allocated checker type records into typed arenas, reducing heap allocation overhead while preserving existing type construction behavior.

Changes:

  • Adds arenas for ten common checker type representations.
  • Routes corresponding constructors through arena allocation.
File Description
tsc/​internal/​checker/​checker.go Adds typed arenas and uses them for common type allocations.

🧠 Review effort: Balanced


💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

@github-project-automation github-project-automation Bot moved this from Not started to Needs merge in PR Backlog Oct 13, 2026
@jakebailey
Jake Bailey (jakebailey) added this pull request to the merge queue Oct 14, 2026
Merged via the queue into main with commit ce609c8 Oct 14, 2026
76 of 78 checks passed
@jakebailey
Jake Bailey (jakebailey) deleted the jakebailey/mem/batched-type-allocs branch October 14, 2026 01:07
@github-project-automation github-project-automation Bot moved this from Needs merge to Done in PR Backlog Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Author: Team 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