Skip to content
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

Filter return type inferences by constraint applicability #58910

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

Andarist
Copy link
Contributor

fixes #50719
fixes #41461

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Jun 18, 2024
@Andarist Andarist force-pushed the fix/filter-out-return-type-inference-by-constraint-applicability branch from 34d5fbe to b9936e3 Compare June 18, 2024 08:05
}
else {
if (inference.priority! & InferencePriority.ReturnType) {
inference.inferredType = filterContextualInferredType(inferredType, instantiatedConstraint) ?? (fallbackType && filterContextualInferredType(fallbackType, instantiatedConstraint)) ?? instantiatedConstraint;
Copy link
Member

Choose a reason for hiding this comment

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

We only need to bother with this filtering if the constraint check for the whole union fails, right? (Since if it passes, no filtering will occur, as every union member must also pass.) This can probably be inside the comparison branch below?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That’s right but it felt cleaner to have this in a separate branch. Shouldnt filterType already optimize for array/type allocations?

@Andarist Andarist requested a review from weswigham June 19, 2024 10:17
@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jun 19, 2024

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 @jakebailey, the results of running the DT tests are ready.

There were interesting changes:

Branch only errors:

Package: jest
Error:

Error: 
/mnt/vss/_work/1/DefinitelyTyped/types/jest/jest-tests.ts
  762:1  error  TypeScript@local compile error: 
Type 'SpyInstance<void, [number | void], any>' is not assignable to type 'SpiedSetter<number>'.
  Types of property 'mock' are incompatible.
    Type 'MockContext<void, [number | void], any>' is not assignable to type 'MockContext<void, [number], any>'.
      Type '[number | void]' is not assignable to type '[number]'  @definitelytyped/expect

✖ 1 problem (1 error, 0 warnings)

    at combineErrorsAndWarnings (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.21_typescript@5.6.0-dev.20240619/node_modules/@definitelytyped/dtslint/dist/index.js:194:28)
    at runTests (/mnt/vss/_work/1/DefinitelyTyped/node_modules/.pnpm/@definitelytyped+dtslint@0.2.21_typescript@5.6.0-dev.20240619/node_modules/@definitelytyped/dtslint/dist/index.js:186:20)

You can check the log here.

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

webpack

tsconfig.types.json

@typescript-bot
Copy link
Collaborator

@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 - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,243 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 193,782k (± 0.94%) 192,726k (± 0.75%) ~ 192,087k 195,687k p=0.471 n=6
Parse Time 1.30s (± 0.93%) 1.29s (± 2.10%) ~ 1.25s 1.31s p=0.422 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.40s (± 0.44%) 9.43s (± 0.28%) ~ 9.40s 9.46s p=0.258 n=6
Emit Time 2.74s (± 0.74%) 2.76s (± 0.50%) ~ 2.74s 2.78s p=0.105 n=6
Total Time 14.16s (± 0.17%) 14.19s (± 0.31%) ~ 14.12s 14.24s p=0.148 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,138 +24 (+ 0.00%) ~ ~ p=0.001 n=6
Types 407,051 407,082 +31 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 1,218,315k (± 0.00%) 1,218,358k (± 0.00%) ~ 1,218,299k 1,218,401k p=0.092 n=6
Parse Time 6.64s (± 0.57%) 6.68s (± 0.79%) ~ 6.64s 6.78s p=0.086 n=6
Bind Time 1.88s (± 1.38%) 1.87s (± 1.17%) ~ 1.85s 1.91s p=0.618 n=6
Check Time 30.59s (± 0.26%) 30.68s (± 0.42%) ~ 30.50s 30.88s p=0.199 n=6
Emit Time 13.56s (± 0.36%) 13.55s (± 0.27%) ~ 13.48s 13.58s p=0.627 n=6
Total Time 52.67s (± 0.15%) 52.78s (± 0.24%) ~ 52.59s 52.95s p=0.149 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 4 🔻+4 (+ ∞%) ~ ~ p=0.001 n=6
Symbols 2,133,420 2,131,417 -2,003 (- 0.09%) ~ ~ p=0.001 n=6
Types 926,456 925,839 -617 (- 0.07%) ~ ~ p=0.001 n=6
Memory used 2,115,464k (± 0.00%) 2,114,668k (± 0.00%) -796k (- 0.04%) 2,114,572k 2,114,839k p=0.005 n=6
Parse Time 6.60s (± 0.17%) 6.60s (± 0.25%) ~ 6.58s 6.62s p=0.566 n=6
Bind Time 2.33s (± 0.22%) 2.34s (± 0.96%) ~ 2.30s 2.37s p=0.437 n=6
Check Time 70.66s (± 0.48%) 70.45s (± 1.32%) ~ 68.63s 71.17s p=0.873 n=6
Emit Time 0.14s (± 3.77%) 0.13s (± 3.87%) ~ 0.13s 0.14s p=0.311 n=6
Total Time 79.73s (± 0.42%) 79.52s (± 1.15%) ~ 77.73s 80.25s p=0.873 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,762 1,230,884 +122 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,187 261,272 +85 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,345,612k (± 0.04%) 2,346,043k (± 0.04%) ~ 2,345,013k 2,347,238k p=0.575 n=6
Parse Time 4.99s (± 1.28%) 5.00s (± 0.95%) ~ 4.93s 5.06s p=0.748 n=6
Bind Time 1.90s (± 0.87%) 1.90s (± 0.70%) ~ 1.89s 1.92s p=0.616 n=6
Check Time 33.74s (± 0.26%) 33.80s (± 0.18%) ~ 33.71s 33.86s p=0.170 n=6
Emit Time 2.71s (± 2.78%) 2.69s (± 2.56%) ~ 2.61s 2.81s p=0.298 n=6
Total Time 43.36s (± 0.38%) 43.41s (± 0.25%) ~ 43.25s 43.54s p=0.521 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,230,762 1,230,884 +122 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,187 261,272 +85 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,423,016k (± 0.03%) 2,422,796k (± 0.02%) ~ 2,421,965k 2,423,472k p=0.378 n=6
Parse Time 7.71s (± 0.56%) 7.71s (± 0.60%) ~ 7.67s 7.79s p=0.936 n=6
Bind Time 2.50s (± 0.86%) 2.51s (± 0.53%) ~ 2.49s 2.53s p=0.332 n=6
Check Time 49.53s (± 0.40%) 49.53s (± 0.25%) ~ 49.41s 49.74s p=0.936 n=6
Emit Time 3.86s (± 2.06%) 3.90s (± 2.78%) ~ 3.74s 4.03s p=0.689 n=6
Total Time 63.63s (± 0.30%) 63.66s (± 0.20%) ~ 63.53s 63.88s p=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,573 258,690 +117 (+ 0.05%) ~ ~ p=0.001 n=6
Types 104,819 104,890 +71 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 428,178k (± 0.01%) 428,374k (± 0.00%) +197k (+ 0.05%) 428,341k 428,397k p=0.005 n=6
Parse Time 3.31s (± 0.56%) 3.33s (± 0.58%) ~ 3.31s 3.36s p=0.120 n=6
Bind Time 1.32s (± 1.58%) 1.32s (± 1.41%) ~ 1.29s 1.34s p=1.000 n=6
Check Time 17.75s (± 0.20%) 17.77s (± 0.56%) ~ 17.67s 17.89s p=0.746 n=6
Emit Time 1.37s (± 1.81%) 1.37s (± 0.85%) ~ 1.35s 1.38s p=0.681 n=6
Total Time 23.73s (± 0.26%) 23.78s (± 0.38%) ~ 23.67s 23.89s p=0.467 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,675 +110 (+ 0.05%) ~ ~ p=0.001 n=6
Types 93,734 93,805 +71 (+ 0.08%) ~ ~ p=0.001 n=6
Memory used 369,473k (± 0.03%) 369,626k (± 0.04%) ~ 369,439k 369,828k p=0.066 n=6
Parse Time 2.78s (± 0.95%) 2.78s (± 1.00%) ~ 2.74s 2.81s p=0.871 n=6
Bind Time 1.58s (± 0.53%) 1.58s (± 1.17%) ~ 1.57s 1.62s p=0.325 n=6
Check Time 15.45s (± 0.29%) 15.47s (± 0.20%) ~ 15.42s 15.51s p=0.520 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 19.82s (± 0.16%) 19.83s (± 0.29%) ~ 19.72s 19.88s p=0.145 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=NaN n=0
Symbols 0 0 ~ ~ ~ p=NaN n=0
Types 0 0 ~ ~ ~ p=NaN n=0
Memory used 0k 0k ~ ~ ~ p=NaN n=0
Parse Time 0s 0s ~ ~ ~ p=NaN n=0
Bind Time 0s 0s ~ ~ ~ p=NaN n=0
Check Time 0s 0s ~ ~ ~ p=NaN n=0
Emit Time 0s 0s ~ ~ ~ p=NaN n=0
Total Time 0s 0s ~ ~ ~ p=NaN n=0
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,116 267,119 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 108,756 108,757 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 411,518k (± 0.01%) 411,609k (± 0.03%) ~ 411,523k 411,825k p=0.093 n=6
Parse Time 3.82s (± 0.33%) 3.81s (± 0.55%) ~ 3.79s 3.84s p=0.325 n=6
Bind Time 1.70s (± 0.69%) 1.69s (± 0.53%) ~ 1.68s 1.70s p=0.270 n=6
Check Time 16.74s (± 0.47%) 16.75s (± 0.57%) ~ 16.62s 16.88s p=0.873 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 22.26s (± 0.32%) 22.25s (± 0.47%) ~ 22.10s 22.40s p=1.000 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 523,765 523,005 -760 (- 0.15%) ~ ~ p=0.001 n=6
Types 178,055 178,065 +10 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 461,594k (± 0.07%) 461,628k (± 0.06%) ~ 461,208k 461,961k p=0.575 n=6
Parse Time 3.94s (± 0.27%) 3.93s (± 0.65%) ~ 3.90s 3.96s p=0.466 n=6
Bind Time 1.47s (± 0.71%) 1.47s (± 0.71%) ~ 1.46s 1.49s p=1.000 n=6
Check Time 22.20s (± 0.36%) 22.26s (± 0.53%) ~ 22.10s 22.44s p=0.295 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.61s (± 0.26%) 27.67s (± 0.47%) ~ 27.49s 27.84s p=0.574 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

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

Something interesting changed - please have a look.

Details

alan2207/bulletproof-react

tsconfig.json

apollographql/apollo-client

1 of 12 projects failed to build with the old tsc and were ignored

tsconfig.json

src/tsconfig.json

invoke-ai/InvokeAI

invokeai/frontend/web/tsconfig.json

mattermost/mattermost

1 of 4 projects failed to build with the old tsc and were ignored

webapp/channels/tsconfig.json

@typescript-bot
Copy link
Collaborator

@jakebailey Here are some more interesting changes from running the top 400 repos suite

Details

microsoft/vscode

5 of 54 projects failed to build with the old tsc and were ignored

src/tsconfig.tsec.json

@typescript-bot
Copy link
Collaborator

@jakebailey Here are some more interesting changes from running the top 400 repos suite

Details

pixijs/pixijs

tsconfig.types.json

tsconfig.json

recharts/recharts

1 of 4 projects failed to build with the old tsc and were ignored

storybook/tsconfig.json

tailwindlabs/headlessui

1 of 5 projects failed to build with the old tsc and were ignored

packages/@headlessui-react/tsconfig.json

@gabritto
Copy link
Member

gabritto commented Jul 3, 2024

This had a ton of breaks on the extended tests, so seems like not a good idea?

@Andarist
Copy link
Contributor Author

Andarist commented Jul 3, 2024

yep, might not be a good idea after all - I didn't yet look at those breaks though, at the very least I'd like to get some new test cases based on them so we could add them to main

@Andarist
Copy link
Contributor Author

Slimmed down repro based on headlessui:

type Query = (
  container: HTMLElement,
  ...args: any[]
) =>
  | Error
  | HTMLElement
  | HTMLElement[]
  | Promise<HTMLElement[]>
  | Promise<HTMLElement>
  | null;

interface Queries {
  [T: string]: Query;
}

type FindByText<T extends HTMLElement = HTMLElement> = (
  container: HTMLElement,
  text: string,
) => Promise<T>;

declare function findByLabelText<T extends HTMLElement = HTMLElement>(
  ...args: Parameters<FindByText<T>>
): ReturnType<FindByText<T>>;

const queries = {
  findByLabelText,
};

type MapQueries<Q extends Queries = typeof queries> = {
  [P in keyof Q]: Q[P];
};

I didn't quite expect a change in any code like this... I'll continue investigating this.

@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2024

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

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

@jakebailey
Copy link
Member

@typescript-bot test it

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jul 13, 2024

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 @jakebailey, the results of running the DT tests are ready.

Everything looks the same!

You can check the log here.

@typescript-bot
Copy link
Collaborator

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

Something interesting changed - please have a look.

Details

webpack

tsconfig.types.json

@typescript-bot
Copy link
Collaborator

@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 - node (v18.15.0, x64)
Errors 30 30 ~ ~ ~ p=1.000 n=6
Symbols 62,153 62,153 ~ ~ ~ p=1.000 n=6
Types 50,242 50,243 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 193,441k (± 0.93%) 193,921k (± 1.00%) ~ 192,134k 195,755k p=0.936 n=6
Parse Time 1.31s (± 0.94%) 1.29s (± 0.42%) ~ 1.29s 1.30s p=0.152 n=6
Bind Time 0.71s 0.71s ~ ~ ~ p=1.000 n=6
Check Time 9.46s (± 0.52%) 9.46s (± 0.35%) ~ 9.43s 9.52s p=0.683 n=6
Emit Time 2.75s (± 0.44%) 2.76s (± 0.96%) ~ 2.72s 2.79s p=0.684 n=6
Total Time 14.23s (± 0.29%) 14.22s (± 0.35%) ~ 14.17s 14.31s p=0.455 n=6
angular-1 - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 944,114 944,115 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 407,050 407,073 +23 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 1,218,382k (± 0.01%) 1,218,396k (± 0.00%) ~ 1,218,329k 1,218,452k p=0.936 n=6
Parse Time 6.71s (± 0.72%) 6.70s (± 0.39%) ~ 6.66s 6.74s p=0.936 n=6
Bind Time 1.87s (± 1.07%) 1.88s (± 0.29%) ~ 1.87s 1.88s p=0.855 n=6
Check Time 30.61s (± 0.37%) 30.63s (± 0.29%) ~ 30.48s 30.72s p=1.000 n=6
Emit Time 13.64s (± 0.40%) 13.59s (± 0.28%) ~ 13.53s 13.64s p=0.173 n=6
Total Time 52.83s (± 0.33%) 52.79s (± 0.13%) ~ 52.66s 52.85s p=0.810 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,148,730 2,149,048 +318 (+ 0.01%) ~ ~ p=0.001 n=6
Types 929,320 929,397 +77 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 2,116,434k (± 0.00%) 2,116,472k (± 0.00%) ~ 2,116,400k 2,116,514k p=0.093 n=6
Parse Time 6.58s (± 0.23%) 6.58s (± 0.24%) ~ 6.55s 6.59s p=0.869 n=6
Bind Time 2.33s (± 0.22%) 2.32s (± 0.18%) ~ 2.32s 2.33s p=0.112 n=6
Check Time 70.77s (± 0.37%) 70.59s (± 0.40%) ~ 70.21s 70.95s p=0.296 n=6
Emit Time 0.14s (± 2.95%) 0.14s (± 2.88%) ~ 0.14s 0.15s p=0.218 n=6
Total Time 79.81s (± 0.33%) 79.63s (± 0.34%) ~ 79.26s 79.95s p=0.297 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,948 1,226,061 +113 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,589 261,671 +82 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,338,519k (± 0.02%) 2,339,208k (± 0.02%) +689k (+ 0.03%) 2,338,645k 2,339,759k p=0.045 n=6
Parse Time 5.09s (± 0.75%) 5.08s (± 0.93%) ~ 5.03s 5.14s p=0.810 n=6
Bind Time 1.90s (± 0.55%) 1.91s (± 0.86%) ~ 1.89s 1.93s p=0.361 n=6
Check Time 34.12s (± 0.22%) 34.15s (± 0.26%) ~ 34.00s 34.25s p=0.471 n=6
Emit Time 3.25s (± 1.55%) 3.23s (± 1.54%) ~ 3.19s 3.32s p=0.521 n=6
Total Time 44.36s (± 0.24%) 44.38s (± 0.27%) ~ 44.18s 44.53s p=0.936 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,948 1,226,061 +113 (+ 0.01%) ~ ~ p=0.001 n=6
Types 261,589 261,671 +82 (+ 0.03%) ~ ~ p=0.001 n=6
Memory used 2,412,934k (± 0.03%) 2,413,338k (± 0.02%) ~ 2,412,916k 2,414,274k p=0.230 n=6
Parse Time 6.36s (± 0.43%) 6.32s (± 0.61%) ~ 6.28s 6.38s p=0.092 n=6
Bind Time 2.05s (± 0.73%) 2.05s (± 1.51%) ~ 2.02s 2.10s p=0.808 n=6
Check Time 40.74s (± 0.29%) 40.72s (± 0.30%) ~ 40.55s 40.86s p=0.936 n=6
Emit Time 3.98s (± 2.20%) 3.92s (± 1.32%) ~ 3.82s 3.96s p=0.688 n=6
Total Time 53.12s (± 0.31%) 53.01s (± 0.29%) ~ 52.80s 53.22s p=0.471 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 258,230 258,344 +114 (+ 0.04%) ~ ~ p=0.001 n=6
Types 104,789 104,859 +70 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 427,124k (± 0.04%) 427,324k (± 0.06%) +200k (+ 0.05%) 427,089k 427,757k p=0.031 n=6
Parse Time 3.30s (± 0.37%) 3.30s (± 0.65%) ~ 3.28s 3.33s p=0.871 n=6
Bind Time 1.31s (± 0.75%) 1.31s (± 0.62%) ~ 1.30s 1.32s p=0.394 n=6
Check Time 17.79s (± 0.54%) 17.85s (± 0.44%) ~ 17.74s 17.96s p=0.296 n=6
Emit Time 1.64s (± 1.00%) 1.65s (± 1.13%) ~ 1.63s 1.68s p=0.366 n=6
Total Time 24.04s (± 0.41%) 24.11s (± 0.33%) ~ 23.98s 24.21s p=0.336 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 35 35 ~ ~ ~ p=1.000 n=6
Symbols 224,565 224,672 +107 (+ 0.05%) ~ ~ p=0.001 n=6
Types 93,734 93,803 +69 (+ 0.07%) ~ ~ p=0.001 n=6
Memory used 369,481k (± 0.02%) 369,665k (± 0.02%) +184k (+ 0.05%) 369,564k 369,735k p=0.013 n=6
Parse Time 3.43s (± 0.81%) 3.45s (± 0.72%) ~ 3.41s 3.48s p=0.373 n=6
Bind Time 1.93s (± 0.54%) 1.94s (± 0.70%) ~ 1.92s 1.95s p=0.190 n=6
Check Time 19.18s (± 0.42%) 19.19s (± 0.41%) ~ 19.09s 19.28s p=1.000 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.54s (± 0.30%) 24.57s (± 0.40%) ~ 24.47s 24.70s p=0.748 n=6
vscode - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,891,160 2,890,945 -215 (- 0.01%) ~ ~ p=0.001 n=6
Types 978,184 978,308 +124 (+ 0.01%) ~ ~ p=0.001 n=6
Memory used 3,055,016k (± 0.00%) 3,055,037k (± 0.00%) ~ 3,054,933k 3,055,099k p=0.521 n=6
Parse Time 16.95s (± 0.25%) 16.98s (± 0.42%) ~ 16.90s 17.06s p=0.572 n=6
Bind Time 5.13s (± 0.68%) 5.11s (± 0.49%) ~ 5.08s 5.15s p=0.147 n=6
Check Time 89.68s (± 0.32%) 89.96s (± 0.21%) +0.28s (+ 0.32%) 89.68s 90.20s p=0.045 n=6
Emit Time 29.27s (± 1.17%) 29.26s (± 0.81%) ~ 29.00s 29.64s p=0.810 n=6
Total Time 141.03s (± 0.37%) 141.31s (± 0.20%) ~ 140.96s 141.57s p=0.378 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 267,239 267,242 +3 (+ 0.00%) ~ ~ p=0.001 n=6
Types 108,815 108,816 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Memory used 411,842k (± 0.03%) 411,805k (± 0.01%) ~ 411,736k 411,838k p=0.936 n=6
Parse Time 4.74s (± 0.41%) 4.75s (± 0.53%) ~ 4.72s 4.78s p=0.805 n=6
Bind Time 2.09s (± 0.63%) 2.09s (± 0.88%) ~ 2.06s 2.11s p=0.805 n=6
Check Time 20.80s (± 0.32%) 20.79s (± 0.47%) ~ 20.62s 20.89s p=0.809 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 27.63s (± 0.20%) 27.63s (± 0.39%) ~ 27.48s 27.76s p=0.936 n=6
xstate-main - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 510,479 510,479 ~ ~ ~ p=1.000 n=6
Types 161,600 161,600 ~ ~ ~ p=1.000 n=6
Memory used 448,051k (± 0.05%) 447,989k (± 0.07%) ~ 447,701k 448,370k p=0.689 n=6
Parse Time 3.15s (± 0.52%) 3.15s (± 1.04%) ~ 3.12s 3.21s p=0.870 n=6
Bind Time 1.17s (± 0.47%) 1.17s (± 0.44%) ~ 1.16s 1.17s p=0.640 n=6
Check Time 17.04s (± 0.46%) 17.08s (± 0.29%) ~ 17.03s 17.17s p=0.871 n=6
Emit Time 0.00s 0.00s (±244.70%) ~ 0.00s 0.02s p=0.405 n=6
Total Time 21.35s (± 0.39%) 21.40s (± 0.39%) ~ 21.34s 21.56s p=0.748 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

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

Everything looks good!

@Andarist
Copy link
Contributor Author

@gabritto I made a very silly mistake initially. It was somewhat a coincidence that the tests I had passed 😅 This was fixed now and I added extra test cases. The PR is now in a good state and can be reviewed :)

Above we can see some missing implicit anys in webpack. I added a test case based on that, this is a clear improvement.

@ehoogeveen-medweb
Copy link

Aside from the new return type branch, it seems like this also changes the !inferredType case to always use instantiatedConstraint instead of checking whether fallbackType satisfies the constraint. Is that an intended part of this change?

@Andarist
Copy link
Contributor Author

No, that wasn't intentional. Thanks for pointing that out - I corrected the PR but I doubt it will make a difference for any of the extended tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Backlog Bug PRs that fix a backlog bug
Projects
Status: Waiting on author
6 participants