Skip to content

Store merged symbols in a paged symbol link store - #64869

Open
Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:perf/paged-merged-symbols
Open

Jake Bailey (jakebailey) wants to merge 1 commit into
microsoft:mainfrom
jakebailey:perf/paged-merged-symbols

Conversation

@jakebailey

Copy link
Copy Markdown
Member

getMergedSymbol runs on nearly every symbol access, and almost every call misses because few symbols are merge sources. Each miss still paid for a pointer-keyed map hash and probe.

Indexing by dense symbol ID makes the common miss a range check and a page load.

--checkers 4, n=8, default GC settings:

                  │  before    │              after               │
                  │   sec/op   │   sec/op    vs base              │
Tsc/bluesky         2.799 ± 2%   2.767 ± 1%       ~ (p=0.266 n=8)
Tsc/sentry          10.86 ± 2%   10.78 ± 2%       ~ (p=0.314 n=8)
Tsc/t3code-server   13.89 ± 6%   13.50 ± 4%  -2.85% (p=0.050 n=8)
geomean             7.502        7.384       -1.58%

                  │   before     │               after                │
                  │    rss-B     │    rss-B      vs base              │
Tsc/bluesky         1.203Gi ± 2%   1.183Gi ± 2%       ~ (p=0.291 n=8)
Tsc/sentry          3.535Gi ± 6%   3.549Gi ± 6%       ~ (p=1.000 n=8)
Tsc/t3code-server   2.877Gi ± 3%   2.880Gi ± 2%       ~ (p=0.721 n=8)
geomean             2.304Gi        2.296Gi       -0.37%

                  │   before     │               after                │
                  │    heap-B    │    heap-B     vs base              │
Tsc/bluesky         934.8Mi ± 0%   934.5Mi ± 0%  -0.04% (p=0.038 n=8)
Tsc/sentry          2.603Gi ± 0%   2.608Gi ± 0%  +0.16% (p=0.000 n=8)
Tsc/t3code-server   2.312Gi ± 0%   2.301Gi ± 0%  -0.45% (p=0.000 n=8)
geomean             1.765Gi        1.763Gi       -0.11%

getMergedSymbol runs on nearly every symbol access, and almost every
call misses because few symbols are merge sources. Each miss still
paid for a pointer-keyed map hash and probe.

Indexing by dense symbol ID makes the common miss a range check and
a page load.

--checkers 4, n=8, default GC settings:

                  │  before    │              after               │
                  │   sec/op   │   sec/op    vs base              │
Tsc/bluesky         2.799 ± 2%   2.767 ± 1%       ~ (p=0.266 n=8)
Tsc/sentry          10.86 ± 2%   10.78 ± 2%       ~ (p=0.314 n=8)
Tsc/t3code-server   13.89 ± 6%   13.50 ± 4%  -2.85% (p=0.050 n=8)
geomean             7.502        7.384       -1.58%

                  │   before     │               after                │
                  │    rss-B     │    rss-B      vs base              │
Tsc/bluesky         1.203Gi ± 2%   1.183Gi ± 2%       ~ (p=0.291 n=8)
Tsc/sentry          3.535Gi ± 6%   3.549Gi ± 6%       ~ (p=1.000 n=8)
Tsc/t3code-server   2.877Gi ± 3%   2.880Gi ± 2%       ~ (p=0.721 n=8)
geomean             2.304Gi        2.296Gi       -0.37%

                  │   before     │               after                │
                  │    heap-B    │    heap-B     vs base              │
Tsc/bluesky         934.8Mi ± 0%   934.5Mi ± 0%  -0.04% (p=0.038 n=8)
Tsc/sentry          2.603Gi ± 0%   2.608Gi ± 0%  +0.16% (p=0.000 n=8)
Tsc/t3code-server   2.312Gi ± 0%   2.301Gi ± 0%  -0.45% (p=0.000 n=8)
geomean             1.765Gi        1.763Gi       -0.11%
Copilot AI balanced review requested due to automatic review settings October 19, 2026 17:23
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 19, 2026
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 19, 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

The focused storage substitution preserves lookup behavior, with no unresolved findings.

No open issues 🎉

What changed in this PR

Replaces the checker’s merged-symbol map with an existing paged store indexed by symbol ID to reduce lookup overhead.

Changes:

  • Uses a zero-initialized symbolLinkStore instead of an explicitly initialized map.
  • Updates reads and writes while preserving fallback to the original symbol.
File Description
tsc/​internal/​checker/​checker.go Migrates merged-symbol storage and access to the paged store.

Review effort: Balanced

@jakebailey

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) perf test this faster

@typescript-automation

typescript-automation Bot commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
perf test this faster ✅ Started 👀 Results

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey)
The results of the perf run you requested are in!

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - native
Errors 41 41 ~ ~ ~ p=1.000 n=12
Symbols 115,276 115,276 ~ ~ ~ p=1.000 n=12
Types 79,613 79,613 ~ ~ ~ p=1.000 n=12
Memory Used 113,563k (± 0.06%) 113,253k (± 0.06%) -310k (- 0.27%) 113,064k 113,457k p=0.000 n=12
Memory Allocs 2,212,530 (± 0.01%) 2,212,347 (± 0.00%) ~ 2,212,078 2,212,592 p=0.068 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.049s (± 3.00%) 0.049s (± 3.75%) ~ 0.043s 0.052s p=0.943 n=12
Bind Time 0.016s (±12.17%) 0.016s (± 9.21%) ~ 0.014s 0.020s p=0.826 n=12
Check Time 0.565s (± 0.80%) 0.557s (± 0.79%) -0.007s (- 1.28%) 0.547s 0.570s p=0.018 n=12
Emit Time 0.316s (± 2.18%) 0.320s (± 2.42%) ~ 0.299s 0.345s p=0.504 n=12
Total Time 0.954s (± 0.80%) 0.950s (± 0.98%) ~ 0.927s 0.976s p=0.541 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 846,745 (± 0.06%) 847,065 (± 0.09%) ~ 844,684 848,703 p=0.410 n=12
Types 247,032 (± 0.00%) 247,033 (± 0.00%) ~ 247,030 247,042 p=0.530 n=12
Memory Used 596,418k (± 0.03%) 597,202k (± 0.03%) +784k (+ 0.13%) 596,779k 597,876k p=0.000 n=12
Memory Allocs 13,139,814 (± 0.02%) 13,148,529 (± 0.08%) ~ 13,137,054 13,179,984 p=0.143 n=12
Config Time 0.020s (± 1.40%) 0.020s (± 1.21%) ~ 0.020s 0.021s p=1.000 n=12
Parse Time 0.281s (± 2.06%) 0.282s (± 2.86%) ~ 0.264s 0.304s p=1.000 n=12
Bind Time 0.099s (±14.09%) 0.099s (±13.92%) ~ 0.073s 0.135s p=0.854 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.866s (± 0.89%) 1.859s (± 1.49%) ~ 1.794s 1.933s p=0.434 n=12
Total Time 2.287s (± 1.00%) 2.282s (± 1.40%) ~ 2.195s 2.367s p=0.701 n=12
mui-docs - native
Errors 11,405 11,405 ~ ~ ~ p=1.000 n=12
Symbols 4,331,983 4,331,983 ~ ~ ~ p=1.000 n=12
Types 1,370,520 1,370,520 ~ ~ ~ p=1.000 n=12
Memory Used 2,625,154k (± 0.06%) 2,625,505k (± 0.05%) ~ 2,621,533k 2,629,646k p=0.932 n=12
Memory Allocs 27,707,952 (± 0.08%) 27,705,555 (± 0.06%) ~ 27,651,291 27,748,504 p=0.713 n=12
Config Time 0.020s (± 1.52%) 0.020s (± 1.40%) ~ 0.020s 0.021s p=1.000 n=12
Parse Time 0.589s (± 2.89%) 0.569s (± 1.94%) ~ 0.541s 0.601s p=0.066 n=12
Bind Time 0.003s (±12.54%) 0.003s (± 8.64%) ~ 0.002s 0.003s p=0.371 n=12
Check Time 8.634s (± 0.38%) 8.581s (± 0.28%) -0.053s (- 0.61%) 8.543s 8.685s p=0.004 n=12
Emit Time 0.669s (±12.27%) 0.739s (± 9.36%) ~ 0.502s 0.794s p=0.271 n=12
Total Time 10.820s (± 0.94%) 10.823s (± 0.58%) ~ 10.551s 10.898s p=0.319 n=12
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,388,680 1,388,680 ~ ~ ~ p=1.000 n=12
Types 441,862 441,862 ~ ~ ~ p=1.000 n=12
Memory Used 1,313,037k (± 0.68%) 1,316,360k (± 0.51%) ~ 1,303,824k 1,335,513k p=0.347 n=12
Memory Allocs 78,272,951 (± 0.04%) 78,208,042 (± 0.09%) ~ 78,013,324 78,389,819 p=0.089 n=12
Config Time 0.004s (±13.98%) 0.004s (±18.02%) ~ 0.002s 0.006s p=0.577 n=12
Parse Time 0.313s (± 1.93%) 0.309s (± 2.12%) ~ 0.289s 0.326s p=0.297 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.996s (± 0.47%) 1.981s (± 0.44%) -0.015s (- 0.74%) 1.960s 2.005s p=0.037 n=12
Emit Time 0.359s (± 4.53%) 0.356s (± 3.15%) ~ 0.333s 0.392s p=0.799 n=12
Total Time 23.868s (± 0.74%) 23.684s (± 0.37%) -0.184s (- 0.77%) 23.457s 23.958s p=0.039 n=12
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 334,953 334,953 ~ ~ ~ p=1.000 n=12
Types 197,616 197,616 ~ ~ ~ p=1.000 n=12
Memory Used 247,451k (± 0.02%) 246,597k (± 0.02%) -853k (- 0.34%) 246,463k 246,729k p=0.000 n=12
Memory Allocs 4,329,273 (± 0.01%) 4,328,676 (± 0.01%) -597 (- 0.01%) 4,327,716 4,329,486 p=0.017 n=12
Config Time 0.000s (±113.79%) 0.001s (±65.70%) ~ 0.000s 0.001s p=0.400 n=12
Parse Time 0.091s (± 4.22%) 0.088s (± 6.18%) ~ 0.078s 0.099s p=0.213 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 0.799s (± 0.60%) 0.785s (± 0.63%) -0.014s (- 1.79%) 0.776s 0.801s p=0.001 n=12
Emit Time 0.119s (± 8.82%) 0.123s (± 8.71%) ~ 0.085s 0.142s p=0.468 n=12
Total Time 1.056s (± 0.86%) 1.042s (± 1.02%) ~ 1.017s 1.064s p=0.080 n=12
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=12
Symbols 303,834 303,834 ~ ~ ~ p=1.000 n=12
Types 181,663 181,663 ~ ~ ~ p=1.000 n=12
Memory Used 215,230k (± 0.02%) 214,663k (± 0.02%) -567k (- 0.26%) 214,574k 214,807k p=0.000 n=12
Memory Allocs 1,401,610 (± 0.02%) 1,401,339 (± 0.01%) ~ 1,400,945 1,401,818 p=0.128 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.097s (± 2.24%) 0.097s (± 4.22%) ~ 0.086s 0.107s p=0.680 n=12
Bind Time 0.039s (± 9.53%) 0.045s (± 9.87%) 🔻+0.005s (+14.04%) 0.030s 0.052s p=0.032 n=12
Check Time 0.746s (± 0.92%) 0.734s (± 0.91%) -0.012s (- 1.65%) 0.721s 0.761s p=0.014 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.897s (± 0.65%) 0.890s (± 0.73%) ~ 0.877s 0.915s p=0.108 n=12
vscode - native
Errors 396 396 ~ ~ ~ p=1.000 n=12
Symbols 12,386,876 12,386,876 ~ ~ ~ p=1.000 n=12
Types 4,049,733 4,049,733 ~ ~ ~ p=1.000 n=12
Memory Used 5,821,308k (± 0.02%) 5,816,151k (± 0.02%) -5,157k (- 0.09%) 5,814,651k 5,818,452k p=0.000 n=12
Memory Allocs 59,185,764 (± 0.01%) 59,183,471 (± 0.01%) ~ 59,174,370 59,220,265 p=0.347 n=12
Config Time 0.076s 0.076s (± 0.43%) +0.001s (+ 0.66%) 0.076s 0.077s p=0.014 n=12
Parse Time 1.812s (± 2.74%) 1.839s (± 1.95%) ~ 1.721s 1.907s p=0.164 n=12
Bind Time 0.726s (±14.37%) 0.648s (±12.00%) ~ 0.513s 0.917s p=0.319 n=12
Check Time 15.584s (± 1.02%) 15.419s (± 1.02%) ~ 15.109s 15.741s p=0.089 n=12
Emit Time 5.465s (± 7.30%) 5.599s (± 7.40%) ~ 4.530s 6.423s p=0.579 n=12
Total Time 23.752s (± 1.41%) 23.672s (± 1.44%) ~ 22.699s 24.356s p=0.799 n=12
webpack - native
Errors 598 598 ~ ~ ~ p=1.000 n=12
Symbols 1,398,302 1,398,302 ~ ~ ~ p=1.000 n=12
Types 670,900 670,900 ~ ~ ~ p=1.000 n=12
Memory Used 885,667k (± 0.01%) 886,476k (± 0.02%) +809k (+ 0.09%) 885,960k 886,859k p=0.000 n=12
Memory Allocs 6,925,456 (± 0.01%) 6,928,389 (± 0.04%) +2,932 (+ 0.04%) 6,925,119 6,941,872 p=0.001 n=12
Config Time 0.009s 0.009s ~ ~ ~ p=1.000 n=12
Parse Time 0.316s (± 1.35%) 0.308s (± 3.79%) ~ 0.276s 0.344s p=0.173 n=12
Bind Time 0.080s (± 8.82%) 0.083s (±14.02%) ~ 0.072s 0.138s p=0.680 n=12
Check Time 2.971s (± 0.56%) 2.887s (± 0.47%) -0.084s (- 2.83%) 2.841s 2.916s p=0.000 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 3.414s (± 0.40%) 3.325s (± 0.49%) -0.089s (- 2.61%) 3.285s 3.358s p=0.000 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,060,810 1,060,810 ~ ~ ~ p=1.000 n=12
Types 389,671 389,671 ~ ~ ~ p=1.000 n=12
Memory Used 471,970k (± 0.03%) 472,299k (± 0.03%) +329k (+ 0.07%) 472,016k 472,657k p=0.000 n=12
Memory Allocs 4,224,017 (± 0.08%) 4,219,966 (± 0.07%) ~ 4,211,791 4,228,347 p=0.089 n=12
Config Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Parse Time 0.109s (± 2.69%) 0.105s (± 3.76%) ~ 0.095s 0.115s p=0.090 n=12
Bind Time 0.031s (±16.52%) 0.039s (±17.28%) ~ 0.027s 0.050s p=0.057 n=12
Check Time 0.914s (± 0.86%) 0.897s (± 0.72%) -0.016s (- 1.81%) 0.887s 0.918s p=0.002 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.061s (± 0.88%) 1.049s (± 0.63%) -0.012s (- 1.15%) 1.031s 1.062s p=0.027 n=12
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • mui-docs - native
  • strada-build-src - native
  • strada-compiler - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 12
Baseline baseline 12

Developer Information:

Download Benchmarks

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