Skip to content

Avoid zeroing unused Relater fields in putRelater - #65811

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:fast-pr/put-relater
Open

Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:fast-pr/put-relater

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This is basically #65327 redone, but with further optimization.

benchstat (-pgo=off, parent vs commit, n=6):

goos: linux
goarch: amd64
             │    old     │               new                │
             │   sec/op   │   sec/op    vs base              │
Tsc/vscode     6.227 ± 1%   6.248 ± 2%       ~ (p=1.000 n=6)
Tsc/mui-docs   3.761 ± 1%   3.732 ± 2%  -0.77% (p=0.015 n=6)
geomean        4.840        4.829       -0.22%

             │     old      │                new                 │
             │    B-rss     │    B-rss      vs base              │
Tsc/vscode     4.615Gi ± 2%   4.576Gi ± 2%       ~ (p=0.394 n=6)
Tsc/mui-docs   2.126Gi ± 7%   2.174Gi ± 4%       ~ (p=0.132 n=6)
geomean        3.132Gi        3.154Gi       +0.71%

putRelater previously zeroed the entire Relater struct on every return
to the free list even when most fields were never touched during a
simple type relation check.

Clear only the fields that were actually populated before returning
the Relater to the free list.

benchstat (-pgo=off, parent vs commit, n=6):

goos: linux
goarch: amd64
             │    old     │               new                │
             │   sec/op   │   sec/op    vs base              │
Tsc/vscode     6.227 ± 1%   6.248 ± 2%       ~ (p=1.000 n=6)
Tsc/mui-docs   3.761 ± 1%   3.732 ± 2%  -0.77% (p=0.015 n=6)
geomean        4.840        4.829       -0.22%

             │     old      │                new                 │
             │    B-rss     │    B-rss      vs base              │
Tsc/vscode     4.615Gi ± 2%   4.576Gi ± 2%       ~ (p=0.394 n=6)
Tsc/mui-docs   2.126Gi ± 7%   2.174Gi ± 4%       ~ (p=0.132 n=6)
geomean        3.132Gi        3.154Gi       +0.71%
Copilot AI balanced review requested due to automatic review settings December 4, 2026 22:35
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Dec 4, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 4, 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 in the relater pool cleanup optimization.

No open issues 🎉

What changed in this PR

Optimizes pooled relater cleanup in the TypeScript checker, building on #65327 to avoid unnecessary field resets.

Changes:

  • Replaces whole-struct assignment with targeted field resets.
  • Clears cached relation keys only when used and preserves reusable stack storage.
File Description
tsc/​internal/​checker/​relater.go Reduces reset work when returning relaters to the pool.

Review effort: Balanced

This branch has not been deployed

No deployments
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: Not started

Development

Successfully merging this pull request may close these issues.

2 participants