Skip to content

Skip unrelated literal-keyed constituents when narrowing - #65639

Open
Jake Bailey (jakebailey) wants to merge 3 commits into
microsoft:mainfrom
jakebailey:fix-65620-literal-narrowing
Open

Jake Bailey (jakebailey) wants to merge 3 commits into
microsoft:mainfrom
jakebailey:fix-65620-literal-narrowing

Conversation

@jakebailey

Copy link
Copy Markdown
Member

This was found as part of #65064, surprisingly.


Narrowing a union by a type guard relates each constituent of the narrowed type to each constituent of the candidate, with up to four subtype checks per pair. With large unions of literals, such as the 4,000 template literal keys in #65620, that is millions of checks. When one side is a branded literal like "k.0001" & { value: T }, each check goes through a full structural relation and is cached, so the relation cache overflows and every later check reports excessive complexity at the same node.

Two literal types with different values, alone or intersected with object types, are never subtypes of each other. Narrowing now skips such pairs, and when a candidate constituent has a literal key, it maps only the constituents with the same value and those without a literal key, instead of mapping over the whole union.

Fixes #65620

Narrowing a union by a type guard relates each constituent of the
narrowed type to each constituent of the candidate, with up to four
subtype checks per pair. With large unions of literals, such as the
4,000 template literal keys in 65620, that is millions of checks. When
one side is a branded literal like `"k.0001" & { value: T }`, each check
goes through a full structural relation and is cached, so the relation
cache overflows and every later check reports excessive complexity at
the same node.

Two literal types with different values, alone or intersected with
object types, are never subtypes of each other. Narrowing now skips
such pairs, and when a candidate constituent has a literal key, it maps
only the constituents with the same value and those without a literal
key, instead of mapping over the whole union.

Fixes 65620
Copilot AI balanced review requested due to automatic review settings November 23, 2026 17:13
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Nov 23, 2026
@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 23, 2026
@jakebailey

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

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

Command Status Results
test top400 ✅ Started ✅ Results
user test this ✅ Started ✅ Results
run dt ✅ Started ✅ Results
perf test this faster ✅ Started 👀 Results

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.

🟡 Changes recommended

The narrowing optimization incorrectly drops NaN-valued enum members, including those in branded intersections, so it needs a NaN exclusion and regression coverage.

1 open issue
What changed in this PR

This PR optimizes type-guard narrowing in the compiler to avoid excessive subtype checks on large literal unions, addressing the performance issue reported in #65620.

Changes:

  • Skips comparisons between literal-keyed types with different values.
  • Indexes union constituents to limit checks to matching literal values and unkeyed types.
  • Adds regression tests for branded-literal narrowing and a 4,000-member union.
File Description
tsc/​internal/​checker/​flow.go Adds literal-key filtering and indexed narrowing.
tsc/​testdata/​tests/​cases/​compiler/​narrowingLargeLiteralUnionByBrandedLiterals.ts Reproduces the large-union performance issue.
tsc/​testdata/​tests/​cases/​compiler/​narrowingByLiteralKeyedTypes.ts Covers narrowing across literals, enums, generics, and objects.
tsc/​testdata/​baselines/​reference/​compiler/​narrowingLargeLiteralUnionByBrandedLiterals.symbols Records symbols for the large-union regression.
tsc/​testdata/​baselines/​reference/​compiler/​narrowingByLiteralKeyedTypes.types Records expected narrowed types.
tsc/​testdata/​baselines/​reference/​compiler/​narrowingByLiteralKeyedTypes.symbols Records symbols for the narrowing cases.

Review effort: Balanced

Comment thread tsc/internal/checker/flow.go Resolved
@typescript-automation

Copy link
Copy Markdown
Contributor

Hey Jake Bailey (@jakebailey), the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing baseline and pr:

Everything looks good!

@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=20
Symbols 88,381 88,381 ~ ~ ~ p=1.000 n=20
Types 79,149 79,149 ~ ~ ~ p=1.000 n=20
Memory Used 106,276k (± 0.02%) 106,311k (± 0.03%) +37k (+ 0.03%) 106,202k 106,449k p=0.048 n=20
Memory Allocs 1,045,770 (± 0.01%) 1,046,173 (± 0.01%) +413 (+ 0.04%) 1,045,908 1,046,480 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.036s (± 2.79%) 0.037s (± 3.30%) ~ 0.033s 0.043s p=0.135 n=20
Bind Time 0.012s (± 6.68%) 0.011s (± 8.06%) ~ 0.009s 0.015s p=0.221 n=20
Check Time 0.379s (± 0.94%) 0.378s (± 0.82%) ~ 0.369s 0.390s p=0.832 n=20
Emit Time 0.217s (± 0.92%) 0.216s (± 0.83%) ~ 0.209s 0.222s p=0.287 n=20
Total Time 0.651s (± 0.62%) 0.649s (± 0.42%) ~ 0.636s 0.663s p=0.388 n=20
angular-1 - native
Errors 63 63 ~ ~ ~ p=1.000 n=20
Symbols 753,731 753,731 ~ ~ ~ p=1.000 n=20
Types 546,699 546,699 ~ ~ ~ p=1.000 n=20
Memory Used 642,632k (± 0.01%) 642,617k (± 0.01%) ~ 642,284k 642,931k p=0.729 n=20
Memory Allocs 8,308,024 (± 0.03%) 8,309,389 (± 0.07%) ~ 8,303,369 8,358,529 p=0.756 n=20
Config Time 0.013s 0.013s (± 1.11%) ~ 0.012s 0.013s p=0.346 n=20
Parse Time 0.210s (± 2.82%) 0.210s (± 2.80%) ~ 0.192s 0.232s p=0.985 n=20
Bind Time 0.064s (±12.24%) 0.062s (± 9.70%) ~ 0.053s 0.102s p=1.000 n=20
Check Time 1.108s (± 0.83%) 1.104s (± 0.93%) ~ 1.068s 1.156s p=0.651 n=20
Emit Time 0.741s (± 0.66%) 0.747s (± 0.93%) ~ 0.725s 0.771s p=0.165 n=20
Total Time 2.155s (± 0.45%) 2.152s (± 0.67%) ~ 2.103s 2.197s p=0.701 n=20
arktype - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 676,777 676,777 ~ ~ ~ p=1.000 n=20
Types 937,629 937,629 ~ ~ ~ p=1.000 n=20
Memory Used 473,879k (± 0.01%) 473,896k (± 0.01%) ~ 473,713k 474,065k p=0.784 n=20
Memory Allocs 11,787,863 (± 0.01%) 11,789,113 (± 0.01%) ~ 11,785,306 11,801,632 p=0.083 n=20
Config Time 0.002s 0.002s ~ ~ ~ p=1.000 n=20
Parse Time 0.067s (± 2.81%) 0.067s (± 2.06%) ~ 0.063s 0.074s p=0.920 n=20
Bind Time 0.021s (±11.05%) 0.019s (± 8.74%) ~ 0.017s 0.032s p=0.320 n=20
Check Time 1.466s (± 0.41%) 1.471s (± 0.44%) ~ 1.451s 1.493s p=0.457 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 1.595s (± 0.43%) 1.600s (± 0.45%) ~ 1.573s 1.630s p=0.330 n=20
class-transformer - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 45,378 45,378 ~ ~ ~ p=1.000 n=20
Types 7,565 7,565 ~ ~ ~ p=1.000 n=20
Memory Used 27,708k (± 0.03%) 27,705k (± 0.02%) ~ 27,675k 27,731k p=0.498 n=20
Memory Allocs 231,661 (± 0.04%) 231,656 (± 0.05%) ~ 231,148 232,196 p=0.622 n=20
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.016s (± 4.16%) 0.017s (± 2.91%) ~ 0.015s 0.019s p=0.286 n=20
Bind Time 0.006s (±11.45%) 0.005s (±12.42%) ~ 0.004s 0.008s p=0.550 n=20
Check Time 0.015s (± 6.80%) 0.015s (± 6.18%) ~ 0.013s 0.018s p=0.969 n=20
Emit Time 0.014s (± 7.38%) 0.014s (± 7.04%) ~ 0.012s 0.017s p=0.906 n=20
Total Time 0.053s (± 1.35%) 0.053s (± 1.38%) ~ 0.050s 0.056s p=0.740 n=20
effect - native
Errors 12 12 ~ ~ ~ p=1.000 n=20
Symbols 1,234,260 1,234,260 ~ ~ ~ p=1.000 n=20
Types 892,037 892,037 ~ ~ ~ p=1.000 n=20
Memory Used 940,405k (± 0.01%) 940,217k (± 0.02%) ~ 939,565k 940,720k p=0.105 n=20
Memory Allocs 11,706,489 (± 0.03%) 11,706,964 (± 0.07%) ~ 11,697,620 11,777,712 p=0.546 n=20
Config Time 0.006s 0.006s ~ ~ ~ p=1.000 n=20
Parse Time 0.328s (± 1.20%) 0.331s (± 1.51%) ~ 0.311s 0.348s p=0.368 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 1.818s (± 0.66%) 1.816s (± 0.51%) ~ 1.789s 1.857s p=0.956 n=20
Emit Time 0.953s (± 3.73%) 0.955s (± 2.69%) ~ 0.839s 1.028s p=0.956 n=20
Total Time 3.279s (± 1.02%) 3.279s (± 0.70%) ~ 3.200s 3.358s p=1.000 n=20
mui-docs - native
Errors 11,405 11,405 ~ ~ ~ p=1.000 n=20
Symbols 3,692,413 3,692,413 ~ ~ ~ p=1.000 n=20
Types 1,351,476 1,351,476 ~ ~ ~ p=1.000 n=20
Memory Used 1,652,038k (± 0.06%) 1,652,922k (± 0.07%) ~ 1,649,085k 1,657,457k p=0.216 n=20
Memory Allocs 24,322,669 (± 0.06%) 24,323,210 (± 0.06%) ~ 24,257,622 24,382,652 p=0.985 n=20
Config Time 0.016s (± 1.40%) 0.016s (± 1.08%) ~ 0.015s 0.016s p=0.930 n=20
Parse Time 0.543s (± 2.21%) 0.542s (± 1.82%) ~ 0.488s 0.580s p=0.388 n=20
Bind Time 0.002s (± 7.95%) 0.002s (± 9.21%) ~ 0.002s 0.003s p=0.718 n=20
Check Time 5.463s (± 0.26%) 5.463s (± 0.48%) ~ 5.387s 5.663s p=0.674 n=20
Emit Time 0.582s (± 5.12%) 0.611s (± 5.76%) ~ 0.495s 0.739s p=0.189 n=20
Total Time 7.538s (± 0.57%) 7.572s (± 0.58%) ~ 7.359s 7.676s p=0.202 n=20
sentry - native
Errors 1 1 ~ ~ ~ p=1.000 n=20
Symbols 4,781,644 4,781,644 ~ ~ ~ p=1.000 n=20
Types 2,590,383 2,590,383 ~ ~ ~ p=1.000 n=20
Memory Used 2,790,211k (± 0.02%) 2,791,118k (± 0.05%) ~ 2,788,137k 2,802,401k p=0.498 n=20
Memory Allocs 73,795,936 (± 0.05%) 73,785,439 (± 0.09%) ~ 73,496,149 74,231,890 p=0.596 n=20
Config Time 0.044s (± 0.70%) 0.044s (± 0.63%) ~ 0.043s 0.045s p=0.758 n=20
Parse Time 0.977s (± 1.58%) 0.986s (± 2.87%) ~ 0.922s 1.152s p=1.000 n=20
Bind Time 0.286s (± 9.59%) 0.309s (± 9.82%) ~ 0.251s 0.431s p=0.133 n=20
Check Time 13.170s (± 0.39%) 13.164s (± 0.48%) ~ 12.983s 13.346s p=0.927 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 14.545s (± 0.30%) 14.574s (± 0.37%) ~ 14.407s 14.766s p=0.452 n=20
social-app - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 1,838,865 1,838,865 ~ ~ ~ p=1.000 n=20
Types 1,146,817 1,146,817 ~ ~ ~ p=1.000 n=20
Memory Used 938,559k (± 0.01%) 938,479k (± 0.02%) ~ 937,698k 938,934k p=0.368 n=20
Memory Allocs 13,244,926 (± 0.11%) 13,240,120 (± 0.07%) ~ 13,211,357 13,280,007 p=0.674 n=20
Config Time 0.013s (± 1.75%) 0.013s (± 1.75%) ~ 0.013s 0.014s p=0.209 n=20
Parse Time 0.338s (± 2.11%) 0.337s (± 1.77%) ~ 0.317s 0.363s p=0.812 n=20
Bind Time 0.080s (± 7.93%) 0.082s (±10.44%) ~ 0.067s 0.129s p=0.538 n=20
Check Time 2.878s (± 0.50%) 2.879s (± 0.42%) ~ 2.824s 2.922s p=0.522 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 3.334s (± 0.30%) 3.334s (± 0.27%) ~ 3.305s 3.368s p=0.966 n=20
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 1,182,486 1,182,486 ~ ~ ~ p=1.000 n=20
Types 435,482 435,482 ~ ~ ~ p=1.000 n=20
Memory Used 1,166,743k (± 0.42%) 1,173,952k (± 0.46%) +7,661k (+ 0.66%) 1,155,111k 1,189,686k p=0.036 n=20
Memory Allocs 39,936,937 (± 0.06%) 40,100,434 (± 0.09%) +166,014 (+ 0.42%) 39,916,290 40,211,221 p=0.000 n=20
Config Time 0.005s (±10.73%) 0.005s (± 9.09%) ~ 0.003s 0.006s p=1.000 n=20
Parse Time 0.285s (± 1.38%) 0.287s (± 1.47%) ~ 0.276s 0.302s p=0.709 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 1.717s (± 0.39%) 1.699s (± 0.59%) -0.018s (- 1.02%) 1.669s 1.741s p=0.002 n=20
Emit Time 0.299s (± 2.38%) 0.307s (± 2.18%) ~ 0.287s 0.337s p=0.076 n=20
Total Time 20.456s (± 0.28%) 20.349s (± 0.30%) -0.094s (- 0.46%) 20.088s 20.600s p=0.019 n=20
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 262,136 262,136 ~ ~ ~ p=1.000 n=20
Types 195,074 195,074 ~ ~ ~ p=1.000 n=20
Memory Used 221,392k (± 0.02%) 221,422k (± 0.02%) ~ 221,232k 221,553k p=0.430 n=20
Memory Allocs 1,884,962 (± 0.01%) 1,892,894 (± 0.02%) +7,949 (+ 0.42%) 1,891,333 1,894,499 p=0.000 n=20
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.104s (± 3.28%) 0.104s (± 3.22%) ~ 0.093s 0.118s p=0.701 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 0.830s (± 0.43%) 0.829s (± 0.49%) ~ 0.816s 0.845s p=0.812 n=20
Emit Time 0.095s (± 4.66%) 0.093s (± 4.71%) ~ 0.082s 0.112s p=0.507 n=20
Total Time 1.080s (± 0.61%) 1.077s (± 0.56%) ~ 1.058s 1.113s p=0.388 n=20
t3code-server - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 4,344,905 4,344,905 ~ ~ ~ p=1.000 n=20
Types 3,038,855 3,038,855 ~ ~ ~ p=1.000 n=20
Memory Used 2,392,682k (± 0.02%) 2,392,285k (± 0.01%) ~ 2,391,428k 2,393,781k p=0.312 n=20
Memory Allocs 36,888,835 (± 0.03%) 36,912,210 (± 0.06%) +22,276 (+ 0.06%) 36,851,837 37,005,106 p=0.044 n=20
Config Time 0.006s (± 1.75%) 0.006s (± 3.09%) ~ 0.005s 0.007s p=0.850 n=20
Parse Time 0.547s (± 1.82%) 0.554s (± 2.28%) ~ 0.502s 0.614s p=0.756 n=20
Bind Time 0.146s (± 6.77%) 0.156s (±10.75%) ~ 0.132s 0.248s p=0.265 n=20
Check Time 12.211s (± 0.42%) 12.275s (± 0.65%) ~ 11.957s 12.614s p=0.154 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 12.926s (± 0.43%) 13.006s (± 0.65%) ~ 12.669s 13.362s p=0.090 n=20
tanstack-router - native
Errors 3 3 ~ ~ ~ p=1.000 n=20
Symbols 567,259 567,259 ~ ~ ~ p=1.000 n=20
Types 395,492 395,492 ~ ~ ~ p=1.000 n=20
Memory Used 310,979k (± 0.01%) 311,021k (± 0.01%) ~ 310,842k 311,114k p=0.104 n=20
Memory Allocs 3,962,944 (± 0.03%) 3,963,730 (± 0.03%) ~ 3,961,060 3,970,692 p=0.622 n=20
Config Time 0.001s (±13.05%) 0.001s ~ ~ ~ p=0.346 n=20
Parse Time 0.065s (± 3.79%) 0.064s (± 5.01%) ~ 0.055s 0.078s p=0.825 n=20
Bind Time 0.020s (± 9.17%) 0.021s (±13.35%) ~ 0.016s 0.034s p=0.952 n=20
Check Time 0.839s (± 0.60%) 0.846s (± 0.54%) ~ 0.821s 0.862s p=0.058 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.928s (± 0.41%) 0.935s (± 0.55%) +0.007s (+ 0.80%) 0.914s 0.950s p=0.017 n=20
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=20
Symbols 230,300 230,300 ~ ~ ~ p=1.000 n=20
Types 180,510 180,510 ~ ~ ~ p=1.000 n=20
Memory Used 190,427k (± 0.02%) 190,407k (± 0.02%) ~ 190,238k 190,524k p=0.349 n=20
Memory Allocs 1,284,354 (± 0.02%) 1,290,928 (± 0.01%) +6,628 (+ 0.52%) 1,290,378 1,291,457 p=0.000 n=20
Config Time 0.001s (±10.98%) 0.001s (±20.10%) ~ 0.000s 0.001s p=0.605 n=20
Parse Time 0.093s (± 3.09%) 0.090s (± 3.49%) ~ 0.075s 0.101s p=0.271 n=20
Bind Time 0.036s (± 7.25%) 0.035s (± 6.84%) ~ 0.027s 0.046s p=0.896 n=20
Check Time 0.644s (± 0.77%) 0.642s (± 0.71%) ~ 0.627s 0.660s p=0.514 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.786s (± 0.51%) 0.781s (± 0.61%) ~ 0.760s 0.800s p=0.083 n=20
vscode - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 8,717,624 8,717,624 ~ ~ ~ p=1.000 n=20
Types 5,071,440 5,071,440 ~ ~ ~ p=1.000 n=20
Memory Used 5,811,067k (± 0.02%) 5,809,985k (± 0.01%) ~ 5,806,190k 5,813,621k p=0.189 n=20
Memory Allocs 64,491,826 (± 0.03%) 64,494,178 (± 0.02%) ~ 64,465,488 64,568,465 p=0.452 n=20
Config Time 0.046s (± 0.45%) 0.047s (± 2.20%) +0.000s (+ 0.00%) 0.046s 0.056s p=0.031 n=20
Parse Time 1.747s (± 1.85%) 1.718s (± 1.77%) ~ 1.585s 1.817s p=0.330 n=20
Bind Time 0.517s (± 7.59%) 0.553s (± 9.30%) ~ 0.471s 0.833s p=0.178 n=20
Check Time 14.283s (± 0.66%) 14.178s (± 0.78%) ~ 13.757s 14.603s p=0.097 n=20
Emit Time 4.277s (± 6.86%) 4.480s (± 7.47%) ~ 3.681s 5.510s p=0.475 n=20
Total Time 20.940s (± 1.30%) 21.047s (± 1.39%) ~ 20.294s 21.709s p=0.729 n=20
webpack - native
Errors 654 654 ~ ~ ~ p=1.000 n=20
Symbols 936,483 936,483 ~ ~ ~ p=1.000 n=20
Types 641,568 641,568 ~ ~ ~ p=1.000 n=20
Memory Used 760,042k (± 0.01%) 760,044k (± 0.01%) ~ 759,753k 760,604k p=0.784 n=20
Memory Allocs 6,520,166 (± 0.10%) 6,525,143 (± 0.28%) ~ 6,503,281 6,678,155 p=0.648 n=20
Config Time 0.008s (± 2.33%) 0.008s (± 1.77%) ~ 0.008s 0.009s p=1.000 n=20
Parse Time 0.318s (± 2.83%) 0.317s (± 3.33%) ~ 0.278s 0.354s p=0.956 n=20
Bind Time 0.087s (±12.53%) 0.090s (±13.57%) ~ 0.068s 0.141s p=0.674 n=20
Check Time 3.490s (± 0.38%) 3.491s (± 0.41%) ~ 3.443s 3.547s p=1.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 3.947s (± 0.65%) 3.950s (± 0.54%) ~ 3.873s 4.041s p=0.674 n=20
xstate-main - native
Errors 1 1 ~ ~ ~ p=1.000 n=20
Symbols 4,115,561 4,115,561 ~ ~ ~ p=1.000 n=20
Types 4,217,216 4,217,216 ~ ~ ~ p=1.000 n=20
Memory Used 2,271,330k (± 0.01%) 2,271,469k (± 0.01%) ~ 2,270,691k 2,271,979k p=0.143 n=20
Memory Allocs 45,231,996 (± 0.02%) 45,230,055 (± 0.01%) ~ 45,210,788 45,252,505 p=0.956 n=20
Config Time 0.004s 0.004s (± 2.64%) ~ 0.003s 0.004s p=1.000 n=20
Parse Time 0.201s (± 2.01%) 0.202s (± 2.12%) ~ 0.179s 0.215s p=0.898 n=20
Bind Time 0.058s (± 7.74%) 0.060s (±12.65%) ~ 0.050s 0.109s p=0.761 n=20
Check Time 8.611s (± 0.32%) 8.602s (± 0.35%) ~ 8.475s 8.667s p=0.648 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 8.882s (± 0.29%) 8.875s (± 0.31%) ~ 8.765s 8.942s p=0.812 n=20
System info unknown
Hosts
  • native
Scenarios
  • Compiler-Unions - native
  • angular-1 - native
  • arktype - native
  • class-transformer - native
  • effect - native
  • mui-docs - native
  • sentry - native
  • social-app - native
  • strada-build-src - native
  • strada-compiler - native
  • t3code-server - native
  • tanstack-router - native
  • ts-pre-modules - native
  • vscode - native
  • webpack - native
  • xstate-main - native
Benchmark Name Iterations
Current pr 20
Baseline baseline 20

Developer Information:

Download Benchmarks

Narrowing `N` with an `x is N.A | N.B` guard, where `N.A = NaN`,
drops `N.A`: NaN is equal to no value, itself included, so the
NaN literal type never matches its own literal key.
NaN is equal to no value, itself included, so a NaN-valued enum
member never matched its own key. A NaN literal type now goes
through the relation checks as other types without a literal key
do.
@jakebailey

Copy link
Copy Markdown
Member Author

Disappointingly not a perf win, but, oh well

@typescript-automation

Copy link
Copy Markdown
Contributor

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing baseline and pr:

Everything looks good!

@jakebailey Jake Bailey (jakebailey) added the Domain: Performance Performance related label Nov 23, 2026
@typescript-automation typescript-automation Bot added For Backlog Bug PRs that fix a backlog bug and removed For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Nov 25, 2026

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 Domain: Performance Performance related For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

An assertion over a large union of string literals never finishes

2 participants