Skip to content

Use strict subtype relation in getCommonSupertype #61903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ahejlsberg
Copy link
Member

@ahejlsberg ahejlsberg commented Jun 19, 2025

Experiment to see effects of using strict subtype relation in getCommonSupertype.

@Copilot Copilot AI review requested due to automatic review settings June 19, 2025 15:10
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Jun 19, 2025
@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jun 19, 2025
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR experiments with using a strict subtype relation in the computation of a common supertype.

  • Switched from isTypeSubtypeOf to isTypeStrictSubtypeOf in reduceLeft for type comparison.
  • Aims to leverage structural subtype relations for improved type accuracy.
Comments suppressed due to low confidence (1)

@ahejlsberg
Copy link
Member Author

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 19, 2025

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

@typescript-bot
Copy link
Collaborator

Hey @ahejlsberg, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

@ahejlsberg Here are the results of running the user tests with tsc comparing main and refs/pull/61903/merge:

Something interesting changed - please have a look.

Details

fp-ts

tsconfig.json

tsconfig.eslint.json

@typescript-bot
Copy link
Collaborator

@ahejlsberg
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 - node (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,370 62,370 ~ ~ ~ p=1.000 n=6
Types 50,386 50,386 ~ ~ ~ p=1.000 n=6
Memory used 194,139k (± 0.99%) 194,125k (± 0.96%) ~ 192,894k 196,572k p=0.688 n=6
Parse Time 1.29s 1.30s (± 0.75%) +0.01s (+ 0.90%) 1.29s 1.31s p=0.027 n=6
Bind Time 0.73s 0.73s ~ ~ ~ p=1.000 n=6
Check Time 9.67s (± 0.25%) 9.68s (± 0.32%) ~ 9.64s 9.72s p=0.687 n=6
Emit Time 2.75s (± 0.56%) 2.74s (± 0.83%) ~ 2.71s 2.77s p=0.511 n=6
Total Time 14.45s (± 0.23%) 14.45s (± 0.23%) ~ 14.42s 14.51s p=1.000 n=6
angular-1 - node (v18.15.0, x64)
Errors 56 56 ~ ~ ~ p=1.000 n=6
Symbols 948,750 948,753 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 410,846 410,846 ~ ~ ~ p=1.000 n=6
Memory used 1,224,587k (± 0.00%) 1,224,623k (± 0.00%) ~ 1,224,593k 1,224,698k p=0.054 n=6
Parse Time 6.60s (± 0.94%) 6.60s (± 0.75%) ~ 6.53s 6.65s p=0.872 n=6
Bind Time 1.89s (± 0.80%) 1.88s (± 0.44%) ~ 1.87s 1.89s p=0.607 n=6
Check Time 31.74s (± 0.29%) 31.91s (± 0.15%) +0.17s (+ 0.55%) 31.84s 31.99s p=0.005 n=6
Emit Time 14.85s (± 0.42%) 14.93s (± 0.43%) ~ 14.85s 15.00s p=0.054 n=6
Total Time 55.07s (± 0.20%) 55.33s (± 0.21%) +0.25s (+ 0.46%) 55.14s 55.47s p=0.013 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,561,658 2,561,642 -16 (- 0.00%) ~ ~ p=0.001 n=6
Types 892,631 892,620 -11 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,836,562k (± 0.00%) 2,836,651k (± 0.00%) +89k (+ 0.00%) 2,836,555k 2,836,698k p=0.031 n=6
Parse Time 9.20s (± 0.43%) 9.20s (± 0.28%) ~ 9.16s 9.22s p=0.809 n=6
Bind Time 2.31s (± 0.24%) 2.30s (± 0.70%) ~ 2.27s 2.31s p=0.663 n=6
Check Time 83.49s (± 0.29%) 83.76s (± 0.47%) ~ 83.44s 84.47s p=0.467 n=6
Emit Time 0.30s (± 1.74%) 0.30s (± 1.35%) ~ 0.30s 0.31s p=0.114 n=6
Total Time 95.29s (± 0.25%) 95.56s (± 0.43%) ~ 95.19s 96.27s p=0.575 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,126 1,227,031 -95 (- 0.01%) ~ ~ p=0.001 n=6
Types 267,408 267,400 -8 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,973,403k (±10.02%) 2,607,151k (±14.50%) ~ 2,361,777k 3,096,441k p=0.230 n=6
Parse Time 6.66s (± 0.90%) 6.60s (± 1.61%) ~ 6.53s 6.77s p=0.378 n=6
Bind Time 2.20s (± 1.02%) 2.19s (± 1.13%) ~ 2.16s 2.22s p=0.809 n=6
Check Time 42.79s (± 0.47%) 42.89s (± 0.42%) ~ 42.67s 43.12s p=0.521 n=6
Emit Time 3.48s (± 1.30%) 3.56s (± 3.87%) ~ 3.34s 3.73s p=0.230 n=6
Total Time 55.13s (± 0.35%) 55.24s (± 0.39%) ~ 54.94s 55.54s p=0.471 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,227,126 1,227,031 -95 (- 0.01%) ~ ~ p=0.001 n=6
Types 267,408 267,400 -8 (- 0.00%) ~ ~ p=0.001 n=6
Memory used 2,611,033k (±11.64%) 2,428,786k (± 0.01%) 🟩-182,247k (- 6.98%) 2,428,455k 2,429,093k p=0.013 n=6
Parse Time 5.45s (± 0.92%) 5.40s (± 0.77%) ~ 5.36s 5.46s p=0.077 n=6
Bind Time 1.82s (± 1.62%) 1.83s (± 1.57%) ~ 1.79s 1.86s p=0.416 n=6
Check Time 35.20s (± 0.69%) 35.08s (± 0.13%) ~ 35.00s 35.13s p=0.298 n=6
Emit Time 3.04s (± 1.96%) 3.04s (± 1.33%) ~ 2.99s 3.10s p=0.810 n=6
Total Time 45.50s (± 0.57%) 45.35s (± 0.20%) ~ 45.25s 45.48s p=0.230 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,474 262,514 +40 (+ 0.02%) ~ ~ p=0.001 n=6
Types 107,135 107,137 +2 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 441,696k (± 0.01%) 441,722k (± 0.01%) ~ 441,695k 441,764k p=0.173 n=6
Parse Time 3.52s (± 1.20%) 3.52s (± 0.76%) ~ 3.49s 3.56s p=1.000 n=6
Bind Time 1.33s (± 0.78%) 1.32s (± 0.92%) ~ 1.30s 1.33s p=0.180 n=6
Check Time 18.87s (± 0.19%) 18.89s (± 0.69%) ~ 18.73s 19.11s p=1.000 n=6
Emit Time 1.52s (± 1.13%) 1.52s (± 1.93%) ~ 1.47s 1.55s p=0.462 n=6
Total Time 25.24s (± 0.29%) 25.26s (± 0.55%) ~ 25.12s 25.49s p=1.000 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 71 71 ~ ~ ~ p=1.000 n=6
Symbols 225,327 225,367 +40 (+ 0.02%) ~ ~ p=0.001 n=6
Types 94,288 94,290 +2 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 371,114k (± 0.03%) 371,102k (± 0.01%) ~ 371,057k 371,140k p=0.630 n=6
Parse Time 2.88s (± 0.97%) 2.89s (± 0.78%) ~ 2.87s 2.93s p=0.627 n=6
Bind Time 1.58s (± 1.36%) 1.58s (± 0.74%) ~ 1.56s 1.59s p=1.000 n=6
Check Time 16.27s (± 0.16%) 16.29s (± 0.56%) ~ 16.18s 16.42s p=0.809 n=6
Emit Time 0.00s (±244.70%) 0.00s ~ ~ ~ p=0.405 n=6
Total Time 20.74s (± 0.26%) 20.76s (± 0.50%) ~ 20.64s 20.92s p=0.872 n=6
vscode - node (v18.15.0, x64)
Errors 33 33 ~ ~ ~ p=1.000 n=6
Symbols 3,475,334 3,475,213 -121 (- 0.00%) ~ ~ p=0.001 n=6
Types 1,168,527 1,168,445 -82 (- 0.01%) ~ ~ p=0.001 n=6
Memory used 3,521,660k (± 0.01%) 3,521,455k (± 0.01%) ~ 3,520,939k 3,521,647k p=0.230 n=6
Parse Time 15.09s (± 0.36%) 14.98s (± 0.49%) -0.10s (- 0.70%) 14.89s 15.11s p=0.045 n=6
Bind Time 4.85s (± 0.43%) 4.84s (± 0.65%) ~ 4.79s 4.88s p=1.000 n=6
Check Time 97.05s (± 3.21%) 94.04s (± 1.46%) ~ 93.14s 96.81s p=0.128 n=6
Emit Time 29.86s (± 2.87%) 30.23s (± 7.57%) ~ 29.12s 34.90s p=0.575 n=6
Total Time 146.84s (± 2.54%) 144.10s (± 2.54%) ~ 142.11s 151.55s p=0.230 n=6
webpack - node (v18.15.0, x64)
Errors 2 2 ~ ~ ~ p=1.000 n=6
Symbols 320,000 320,000 ~ ~ ~ p=1.000 n=6
Types 140,356 140,356 ~ ~ ~ p=1.000 n=6
Memory used 474,193k (± 0.03%) 474,175k (± 0.02%) ~ 474,034k 474,380k p=0.936 n=6
Parse Time 4.31s (± 1.04%) 4.33s (± 1.04%) ~ 4.26s 4.40s p=0.747 n=6
Bind Time 1.77s (± 1.78%) 1.77s (± 0.83%) ~ 1.75s 1.79s p=0.627 n=6
Check Time 20.70s (± 0.54%) 20.72s (± 0.35%) ~ 20.63s 20.83s p=0.873 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 26.78s (± 0.61%) 26.83s (± 0.26%) ~ 26.74s 26.93s p=0.689 n=6
xstate-main - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 667,036 667,036 ~ ~ ~ p=1.000 n=6
Types 198,508 198,508 ~ ~ ~ p=1.000 n=6
Memory used 569,721k (± 0.00%) 569,687k (± 0.01%) ~ 569,633k 569,734k p=0.199 n=6
Parse Time 5.50s (± 0.48%) 5.55s (± 0.46%) +0.04s (+ 0.79%) 5.51s 5.58s p=0.028 n=6
Bind Time 1.66s (± 1.18%) 1.66s (± 0.83%) ~ 1.63s 1.67s p=0.625 n=6
Check Time 25.34s (± 0.65%) 25.33s (± 0.45%) ~ 25.19s 25.50s p=0.810 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 32.52s (± 0.51%) 32.54s (± 0.35%) ~ 32.40s 32.71s p=1.000 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@typescript-bot
Copy link
Collaborator

@ahejlsberg Here are the results of running the top 400 repos with tsc comparing main and refs/pull/61903/merge:

Something interesting changed - please have a look.

Details

glideapps/quicktype

7 of 9 projects failed to build with the old tsc and were ignored

packages/quicktype-core/tsconfig.json

outline/outline

tsconfig.json

vuetifyjs/vuetify

3 of 7 projects failed to build with the old tsc and were ignored

packages/vuetify/tsconfig.json

packages/vuetify/tsconfig.dist.json

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