Skip to content

Skip object classification for shared type facts - #64188

Open
Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:skip-shared-object-type-fact-classification
Open

Skip object classification for shared type facts#64188
Mateusz Burzyński (Andarist) wants to merge 1 commit into
microsoft:mainfrom
Andarist:skip-shared-object-type-fact-classification

Conversation

@Andarist

Copy link
Copy Markdown
Contributor

This allows the compiler to skip some work at times. Some of the isEmptyObjectType, isFunctionObjectType calls and alikes performed down the line can be skipped.

Copilot AI balanced review requested due to automatic review settings September 7, 2026 09:29
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Sep 7, 2026
@typescript-automation typescript-automation Bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Sep 7, 2026
@typescript-automation

Copy link
Copy Markdown

This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise.

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 optimization preserves requested type facts while safely avoiding unnecessary member resolution.

Pull request overview

Optimizes type-fact computation by avoiding unnecessary object classification when all object kinds share the requested facts.

Changes:

  • Computes facts common to empty, function, and regular objects.
  • Returns shared facts early when classification cannot affect the result.
File summaries
File Description
tsc/internal/checker/checker.go Adds the shared-fact fast path.
Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 0
  • Review effort level: 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 Sep 8, 2026
@jakebailey

Copy link
Copy Markdown
Member

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Sep 8, 2026

Copy link
Copy Markdown

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
perf test this faster ✅ Started 👀 Results

@typescript-automation

Copy link
Copy Markdown

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,480 115,445 -35 (- 0.03%) ~ ~ p=0.000 n=12
Types 96,945 96,944 -1 (- 0.00%) ~ ~ p=0.000 n=12
Memory Used 149,083k (± 0.47%) 148,938k (± 0.64%) ~ 146,630k 151,494k p=0.713 n=12
Memory Allocs 2,271,360 (± 0.01%) 2,271,116 (± 0.00%) -243 (- 0.01%) 2,270,986 2,271,467 p=0.007 n=12
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Parse Time 0.042s (± 5.44%) 0.041s (± 3.31%) ~ 0.039s 0.046s p=0.503 n=12
Bind Time 0.013s (±15.05%) 0.012s (± 9.27%) ~ 0.010s 0.015s p=0.848 n=12
Check Time 0.493s (± 1.05%) 0.493s (± 1.21%) ~ 0.481s 0.508s p=0.831 n=12
Emit Time 0.268s (± 1.34%) 0.269s (± 2.58%) ~ 0.252s 0.289s p=0.723 n=12
Total Time 0.821s (± 0.75%) 0.822s (± 1.25%) ~ 0.794s 0.846s p=0.989 n=12
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=12
Symbols 847,027 (± 0.11%) 845,757 (± 0.10%) ~ 843,670 848,103 p=0.068 n=12
Types 249,854 (± 0.00%) 249,801 (± 0.00%) -53 (- 0.02%) 249,799 249,805 p=0.000 n=12
Memory Used 794,040k (± 0.09%) 793,372k (± 0.08%) ~ 791,977k 795,524k p=0.114 n=12
Memory Allocs 12,955,126 (± 0.05%) 12,953,592 (± 0.03%) ~ 12,947,426 12,969,234 p=0.478 n=12
Config Time 0.016s 0.016s ~ ~ ~ p=1.000 n=12
Parse Time 0.274s (± 2.44%) 0.271s (± 1.70%) ~ 0.262s 0.281s p=0.325 n=12
Bind Time 0.064s (±13.12%) 0.060s (± 4.98%) ~ 0.057s 0.075s p=0.740 n=12
Check Time 0s 0s ~ ~ ~ p=1.000 n=12
Emit Time 1.638s (± 1.20%) 1.625s (± 0.80%) ~ 1.606s 1.685s p=0.091 n=12
Total Time 2.009s (± 1.36%) 1.989s (± 0.93%) ~ 1.960s 2.072s p=0.070 n=12
mui-docs - native
Errors 11,276 (± 0.03%) 11,274 (± 0.05%) ~ 11,259 11,281 p=0.765 n=12
Symbols 4,267,465 4,262,971 -4,494 (- 0.11%) ~ ~ p=0.000 n=12
Types 1,475,860 1,475,558 -302 (- 0.02%) ~ ~ p=0.000 n=12
Memory Used 4,672,776k (± 0.03%) 4,670,728k (± 0.02%) -2,048k (- 0.04%) 4,667,552k 4,674,841k p=0.039 n=12
Memory Allocs 42,719,555 (± 0.04%) 42,717,437 (± 0.03%) ~ 42,682,970 42,752,562 p=0.977 n=12
Config Time 0.016s (± 2.08%) 0.016s (± 2.12%) ~ 0.015s 0.016s p=1.000 n=12
Parse Time 0.552s (± 2.13%) 0.538s (± 2.84%) ~ 0.499s 0.569s p=0.173 n=12
Bind Time 0.002s 0.002s ~ ~ ~ p=1.000 n=12
Check Time 16.673s (± 0.51%) 16.753s (± 0.49%) ~ 16.547s 16.884s p=0.147 n=12
Emit Time 0.441s (± 2.06%) 0.476s (±15.29%) ~ 0.431s 0.840s p=0.353 n=12
Total Time 18.429s (± 0.54%) 18.559s (± 0.43%) ~ 18.286s 18.744s p=0.052 n=12
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,394,252 1,392,696 -1,556 (- 0.11%) ~ ~ p=0.000 n=12
Types 443,418 443,410 -8 (- 0.00%) ~ ~ p=0.000 n=12
Memory Used 1,649,289k (± 0.30%) 1,643,730k (± 0.24%) -5,559k (- 0.34%) 1,630,027k 1,650,341k p=0.039 n=12
Memory Allocs 97,074,757 (± 0.04%) 97,019,652 (± 0.04%) ~ 96,929,038 97,096,131 p=0.060 n=12
Config Time 0.004s (±20.20%) 0.004s (±21.07%) ~ 0.002s 0.008s p=0.611 n=12
Parse Time 0.193s (± 2.36%) 0.196s (± 1.89%) ~ 0.187s 0.204s p=0.139 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.802s (± 0.32%) 1.800s (± 0.35%) ~ 1.783s 1.822s p=0.370 n=12
Emit Time 0.272s (± 6.87%) 0.275s (± 5.88%) ~ 0.239s 0.322s p=0.681 n=12
Total Time 24.634s (± 0.73%) 24.675s (± 0.61%) ~ 24.404s 25.062s p=0.799 n=12
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 337,531 337,418 -113 (- 0.03%) ~ ~ p=0.000 n=12
Types 198,830 198,827 -3 (- 0.00%) ~ ~ p=0.000 n=12
Memory Used 319,553k (± 0.03%) 319,571k (± 0.07%) ~ 319,276k 320,549k p=0.523 n=12
Memory Allocs 4,672,972 (± 0.01%) 4,672,884 (± 0.01%) ~ 4,671,748 4,674,020 p=0.799 n=12
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=12
Parse Time 0.113s (± 6.21%) 0.114s (± 5.67%) ~ 0.100s 0.132s p=0.701 n=12
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Check Time 1.045s (± 0.32%) 1.048s (± 0.56%) ~ 1.037s 1.062s p=0.619 n=12
Emit Time 0.129s (±11.11%) 0.143s (±10.08%) ~ 0.102s 0.160s p=0.097 n=12
Total Time 1.341s (± 0.93%) 1.356s (± 0.75%) ~ 1.334s 1.382s p=0.103 n=12
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=12
Symbols 305,179 305,172 -7 (- 0.00%) ~ ~ p=0.000 n=12
Types 181,876 181,874 -2 (- 0.00%) ~ ~ p=0.000 n=12
Memory Used 277,217k (± 0.02%) 277,119k (± 0.02%) ~ 276,825k 277,224k p=0.071 n=12
Memory Allocs 1,641,939 (± 0.01%) 1,641,910 (± 0.01%) ~ 1,641,326 1,642,432 p=0.843 n=12
Config Time 0.000s (±146.91%) 0.000s (±113.79%) ~ 0.000s 0.001s p=1.000 n=12
Parse Time 0.098s (± 5.01%) 0.101s (± 4.20%) ~ 0.091s 0.115s p=0.223 n=12
Bind Time 0.039s (±10.61%) 0.038s (±10.42%) ~ 0.031s 0.052s p=0.966 n=12
Check Time 0.835s (± 0.61%) 0.836s (± 0.57%) ~ 0.823s 0.848s p=0.765 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 0.986s (± 0.93%) 0.989s (± 0.82%) ~ 0.971s 1.011s p=0.504 n=12
vscode - native
Errors 349 349 ~ ~ ~ p=1.000 n=12
Symbols 8,463,646 8,451,219 -12,427 (- 0.15%) ~ ~ p=0.000 n=12
Types 2,898,728 2,897,065 -1,663 (- 0.06%) ~ ~ p=0.000 n=12
Memory Used 5,713,459k (± 0.02%) 5,709,986k (± 0.02%) -3,473k (- 0.06%) 5,707,415k 5,712,690k p=0.000 n=12
Memory Allocs 43,911,056 (± 0.02%) 43,898,750 (± 0.03%) -12,306 (- 0.03%) 43,886,057 43,968,153 p=0.000 n=12
Config Time 0.064s (± 0.51%) 0.064s (± 1.65%) ~ 0.063s 0.069s p=0.751 n=12
Parse Time 1.655s (± 3.46%) 1.681s (± 2.63%) ~ 1.566s 1.760s p=0.468 n=12
Bind Time 0.440s (±18.14%) 0.402s (±19.07%) 🟩-0.037s (- 8.47%) 0.333s 0.749s p=0.047 n=12
Check Time 10.236s (± 1.64%) 10.285s (± 1.23%) ~ 9.771s 10.452s p=0.682 n=12
Emit Time 3.738s (±13.15%) 3.547s (±11.31%) ~ 3.168s 4.856s p=0.355 n=12
Total Time 16.228s (± 2.28%) 16.071s (± 2.05%) ~ 15.679s 17.257s p=0.198 n=12
webpack - native
Errors 560 560 ~ ~ ~ p=1.000 n=12
Symbols 929,346 927,905 -1,441 (- 0.16%) ~ ~ p=0.000 n=12
Types 426,678 426,651 -27 (- 0.01%) ~ ~ p=0.000 n=12
Memory Used 718,503k (± 0.02%) 718,006k (± 0.02%) -498k (- 0.07%) 717,571k 718,465k p=0.000 n=12
Memory Allocs 4,699,968 (± 0.02%) 4,699,041 (± 0.02%) ~ 4,697,557 4,702,644 p=0.052 n=12
Config Time 0.008s 0.008s (± 5.88%) ~ 0.008s 0.010s p=0.478 n=12
Parse Time 0.230s (± 1.97%) 0.234s (± 2.91%) ~ 0.218s 0.252s p=0.310 n=12
Bind Time 0.045s (± 0.93%) 0.051s (±12.36%) 🔻+0.006s (+13.12%) 0.045s 0.074s p=0.006 n=12
Check Time 1.255s (± 0.64%) 1.282s (± 2.12%) ~ 1.238s 1.368s p=0.103 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.563s (± 0.76%) 1.602s (± 2.32%) ~ 1.537s 1.741s p=0.057 n=12
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=12
Symbols 1,022,532 1,017,683 -4,849 (- 0.47%) ~ ~ p=0.000 n=12
Types 376,962 376,476 -486 (- 0.13%) ~ ~ p=0.000 n=12
Memory Used 603,501k (± 0.01%) 601,585k (± 0.02%) -1,916k (- 0.32%) 601,315k 601,918k p=0.000 n=12
Memory Allocs 4,754,287 (± 0.04%) 4,745,354 (± 0.04%) -8,933 (- 0.19%) 4,739,818 4,750,272 p=0.000 n=12
Config Time 0.003s (±12.54%) 0.003s (±10.34%) ~ 0.002s 0.003s p=0.667 n=12
Parse Time 0.146s (± 3.32%) 0.151s (± 3.19%) ~ 0.141s 0.163s p=0.202 n=12
Bind Time 0.043s (±17.16%) 0.050s (±15.63%) ~ 0.034s 0.070s p=0.171 n=12
Check Time 1.047s (± 1.52%) 1.086s (± 3.32%) +0.040s (+ 3.79%) 1.023s 1.235s p=0.011 n=12
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=12
Total Time 1.249s (± 1.35%) 1.302s (± 3.25%) 🔻+0.053s (+ 4.24%) 1.223s 1.460s p=0.017 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

@typescript-automation

Copy link
Copy Markdown

Jake Bailey (@jakebailey) Here are the results of running the user tests with tsc comparing main and refs/pull/64188/merge:

There were infrastructure failures potentially unrelated to your change:

  • 2 instances of "Package install failed"
  • 1 instance of "Git clone failed"

Otherwise...

Everything looks good!

@typescript-automation

Copy link
Copy Markdown

Jake Bailey (@jakebailey) Here are the results of running the top 400 repos with tsc comparing main and refs/pull/64188/merge:

Everything looks good!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Needs merge

Development

Successfully merging this pull request may close these issues.

3 participants