Skip to content

[experiment] fully order independent type checking - #65064

Draft
Jake Bailey (jakebailey) wants to merge 189 commits into
microsoft:mainfrom
jakebailey:checker-db
Draft

Jake Bailey (jakebailey) wants to merge 189 commits into
microsoft:mainfrom
jakebailey:checker-db

Conversation

@jakebailey

@jakebailey Jake Bailey (jakebailey) commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

There's too much here to explain, but at a high level, this is a massive change which aims to make the checker entirely order independent, that is, it doesn't matter when you call the checker, which nodes you walk first, if you do or do not pull something, check some other file, helicopter into the wrong part of a cycle, etc, the behavior, diagnostics, everything, will be the same.

Looking at individual commits is my suggested way to look inside, not the entire diff, which will surely crash your browser.

This is all AI driven, so it's a bit hard to unbox (I plan to break this apart since some stuff can be done early), but some interesting tidbits (handwritten by me!)


There's a new checkOrder test option, which makes certain tests variant on interesting orderings, like "what if we visit every single node before checking" or "what if we reverse the order of the files" or even "what if we use PRNG to randomly walk nodes and then check". This up front found on the order of 500 failing tests we already had that were secretly order dependent. These were all fuzzed out and kept.

There are a significant number of new tests which all show various ordering bugs never before discovered.

The first chunk of the PR are fixing places where code peeked at caches that "happened to be filled" instead of calling the actual function to pull on them.

Then, all of the ID-using code gets removed. At the end everything now has an ID independent ordering based on content, flags, the works. This caught a bunch of places where we were not caching things and ending up with types that were by all rights identical but had different IDs and then were unstable.

The big and scary change is the introduction of a new state management type dubbed "memo". Every single piece of checker state was moved into memos on a sidecar object on the checker (maybe for future sharing??). This memo system keeps track of the current computation, what depends on what else, eliminating basically all flags/bools that track "computed" or "resolved"-ness. This tracking also records side effects, including diagnostics, "referenced" marks, deferred checks, emit helper checks. The result is that if you query via the API and that calculates some error, those same errors will appear later if the checker runs.

With those data structures in place, now all of the cycles can be handled. Once a cycle is discovered, the checker starts logging what it's doing, and throws all of that info away assuming it's been poisoned.

All of the different recursion stacks get pulled into a single memo stack, which is a cool simplification too.

Variance is now a fixpoint algorithm, proceeding in rounds until stability. In practice, it doesn't iterate much.

Instantiation limits also stop being global numbers (since of course, that is order dependent side effect stuff). Instead, things get limited by the amount of work that's been done, and if you then pull on caches related to work, it tallies that work up to error consistently when needed. (I don't think this is fully done yet, though, since there are depth limits that are really hard to get right. Still thinking about that.)

In some cases, cycles still can't be fixed up, and so they're made consistent by doing what we've done previously for these cases, which is to pick a canonical place to restart to at least get it consistent.


Unfortunately, this all has a cost; the end of the PR tries to claw back perf, but at the end of the day, if we do more work tracking, we spend more CPU and memory tracking. It's still an open question whether this can be cheapened any more. But, my hope is that this idea is minimal enough that we could then optimize TS as a whole assuming this order-independence, e.g. work stealing, checker recycling, shared state, maybe even using LRU caches, or dumping data to disk.

But, it could also well be that this is slop and impossible to manage. But I don't want to sit on it anymore and want to see some real world effects.

Also, this is really meant to be rebased, so expect this all to be nasty nasty force pushes all the time as this gets tweaked. Unfortunately right now that's like 125+ commits, so that sucks.

However, I think that this will fix countless issues on the tracker. I have no idea how to evaluate all 5k issues to see if this PR fixes them. But it's gotta be a lot.

@typescript-automation typescript-automation Bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Oct 30, 2026
@jakebailey

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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

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

@typescript-automation

Copy link
Copy Markdown
Contributor

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

There were interesting changes:

Branch only errors: d3-selection

Package: d3-selection

Branch error:

Project scope: tsconfig.json

Error: types/d3-selection/d3-selection-tests.ts:1502:9
TypeScript@local compile error TS2769:
No overload matches this call.
The last overload gave the following error.
Argument of type '(enter: Selection<EnterElement, number, HTMLElement, unknown>) => TransitionLike<HTMLParagraphElement, number>' is not assignable to parameter of type 'string | ((elem: Selection<EnterElement, number, HTMLElement, unknown>) => Selection<BaseType, number, HTMLElement, unknown> | TransitionLike<...>)'.
Type '(enter: Selection<EnterElement, number, HTMLElement, unknown>) => TransitionLike<HTMLParagraphElement, number>' is not assignable to type '(elem: Selection<EnterElement, number, HTMLElement, unknown>) => Selection<BaseType, number, HTMLElement, unknown> | TransitionLike<...>'.
Type 'TransitionLike<HTMLParagraphElement, number>' is not assignable to type 'Selection<BaseType, number, HTMLElement, unknown> | TransitionLike<HTMLElement, number>'.
Type 'TransitionLike<HTMLParagraphElement, number>' is not assignable to type 'TransitionLike<HTMLElement, number>'.
The types returned by 'selection().selectAll(...)' are incompatible between these types.
Type 'Selection<null, undefined, HTMLParagraphElement, number>' is not assignable to type 'Selection<null, undefined, HTMLElement, number>'.
Property 'align' is missing in type 'HTMLElement' but required in type 'HTMLParagraphElement'.
    at combineErrorsAndWarnings (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:200:28)
    at runTests (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:192:20)
Branch only errors: absinthe__socket

Package: absinthe__socket

Branch error:

Project scope: tsconfig.json

Error: types/absinthe__socket/absinthe__socket-tests.ts:29:47
TypeScript@local compile error TS2345:
Argument of type 'Notifier<{ userId: number; }, {}>' is not assignable to parameter of type 'Notifier<{}, {}>'.
Types of property 'activeObservers' are incompatible.
Type 'readonly Observer<{ userId: number; }, {}>[]' is not assignable to type 'readonly Observer<{}, {}>[]'.
Type 'Observer<{ userId: number; }, {}>' is not assignable to type 'Observer<{}, {}>'.
Types of property 'onStart' are incompatible.
Type '((notifier: Notifier<{ userId: number; }, {}>) => any) | undefined' is not assignable to type '((notifier: Notifier<{}, {}>) => any) | undefined'.
Type '(notifier: Notifier<{ userId: number; }, {}>) => any' is not assignable to type '(notifier: Notifier<{}, {}>) => any'.
Types of parameters 'notifier' and 'notifier' are incompatible.
Type 'Notifier<{}, {}>' is not assignable to type 'Notifier<{ userId: number; }, {}>'.
Types of property 'activeObservers' are incompatible.
Type 'readonly Observer<{}, {}>[]' is not assignable to type 'readonly Observer<{ userId: number; }, {}>[]'.
Type 'Observer<{}, {}>' is not assignable to type 'Observer<{ userId: number; }, {}>'.
Property 'userId' is missing in type '{}' but required in type '{ userId: number; }'.
    at combineErrorsAndWarnings (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:200:28)
    at runTests (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:192:20)
Branch only errors: react-relay

Package: react-relay

Branch error:

Project scope: tsconfig.json

Error: types/react-relay/test/relay-hooks-tests.tsx:987:13
TypeScript@local compile error TS2344:
Type '{ mainPanelA?: EntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>, Params> | undefined; mainPanelB?: EntryPoint<...> | undefined; }' does not satisfy the constraint 'Record<string, EntryPoint<any, any> | undefined>'.
Property 'mainPanelA' is incompatible with index signature.
Type 'EntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>, Params>' is not assignable to type 'InternalEntryPointRepresentation<any, Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>'.
Types of property 'root' are incompatible.
Type 'JSResourceReference<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>>' is not assignable to type 'JSResourceReference<EntryPointComponent<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>>'.
Type 'EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>' is not assignable to type 'EntryPointComponent<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>'.
Type 'ComponentClass<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any>' is not assignable to type 'EntryPointComponent<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>'.
Type 'ComponentClass<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any>' is not assignable to type 'ComponentClass<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>, any>'.
Types of property 'getDerivedStateFromProps' are incompatible.
Type 'GetDerivedStateFromProps<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any> | undefined' is not assignable to type 'GetDerivedStateFromProps<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>, any> | undefined'.
Type 'GetDerivedStateFromProps<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any>' is not assignable to type 'GetDerivedStateFromProps<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>, any>'.
Types of parameters 'nextProps' and 'nextProps' are incompatible.
Type 'Readonly<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>>' is not assignable to type 'Readonly<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>>'.
Types of property 'extraProps' are incompatible.
Type '{} | null' is not assignable to type '{}'.
Type 'null' is not assignable to type '{}'.

types/react-relay/test/relay-hooks-tests.tsx:1023:13
TypeScript@local compile error TS2322:
Type '(params: { route: string; }) => { entryPoints: { mainPanelA: { entryPoint: EntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>, Params>; entryPointParams: ...; }; mainPanelB?: undefined; } | ...; queries: ...; extraProps: ...; }' is not assignable to type '(entryPointParams: { route: string; }) => PreloadProps<{ route: string; }, {}, Record<string, EntryPoint<any, any> | undefined>, { foo: "bar"; }>'.
Type '{ entryPoints: { mainPanelA: { entryPoint: EntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>, Params>; entryPointParams: { slug: string; }; }; mainPanelB?: undefined; } | ...; queries: {}; extraProps: ...; }' is not assignable to type 'PreloadProps<{ route: string; }, {}, Record<string, EntryPoint<any, any> | undefined>, { foo: "bar"; }>'.
Types of property 'entryPoints' are incompatible.
Type '{ mainPanelA: { entryPoint: EntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>, Params>; entryPointParams: ...; }; mainPanelB?: undefined; } | ...' is not assignable to type 'ThinNestedEntryPointParamsObject<Record<string, EntryPoint<any, any> | undefined>> | undefined'.
Type '{ mainPanelA: { entryPoint: EntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>, Params>; entryPointParams: { slug: string; }; }; mainPanelB?: undefined; }' is not assignable to type 'ThinNestedEntryPointParamsObject<Record<string, EntryPoint<any, any> | undefined>>'.
Property 'mainPanelA' is incompatible with index signature.
Type '{ entryPoint: EntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>, Params>; entryPointParams: { slug: string; }; }' is not assignable to type 'ThinNestedEntryPointParams<EntryPoint<any, any> | undefined>'.
The types of 'entryPoint.root' are incompatible between these types.
Type 'JSResourceReference<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>>' is not assignable to type 'JSResourceReference<EntryPointComponent<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>>'.
Type 'EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>' is not assignable to type 'EntryPointComponent<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>'.
Type 'ComponentClass<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any>' is not assignable to type 'EntryPointComponent<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>'.
Type 'ComponentClass<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any>' is not assignable to type 'ComponentClass<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>, any>'.
Types of property 'getDerivedStateFromProps' are incompatible.
Type 'GetDerivedStateFromProps<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any> | undefined' is not assignable to type 'GetDerivedStateFromProps<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>, any> | undefined'.
Type 'GetDerivedStateFromProps<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>, any>' is not assignable to type 'GetDerivedStateFromProps<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>, any>'.
Types of parameters 'nextProps' and 'nextProps' are incompatible.
Type 'Readonly<EntryPointProps<Record<string, OperationType>, Record<string, EntryPoint<any, any> | undefined>, {}, {} | null>>' is not assignable to type 'Readonly<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>>'.
Types of property 'extraProps' are incompatible.
Type '{} | null' is not assignable to type '{}'.
Type 'null' is not assignable to type '{}'.

types/react-relay/test/relay-hooks-tests.tsx:1054:15
TypeScript@local compile error TS2322:
Type 'Readonly<{ dispose: DisposeFn; entryPoints: { [x: string]: Readonly<...>; }; extraProps: {} | null; getComponent: () => any; isDisposed: boolean; queries: { [x: string]: PreloadedQuery<OperationType, Record<...>>; }; rootModuleID: string; }>' is not assignable to type 'PreloadedEntryPoint<EntryPointComponent<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }>> | undefined'.
Type 'Readonly<{ dispose: DisposeFn; entryPoints: { [x: string]: Readonly<...>; }; extraProps: {} | null; getComponent: () => any; isDisposed: boolean; queries: { [x: string]: PreloadedQuery<OperationType, Record<...>>; }; rootModuleID: string; }>' is not assignable to type 'Readonly<{ dispose: DisposeFn; entryPoints: {}; extraProps: {}; getComponent: () => FunctionComponent<EntryPointProps<{ someQueryRef: SomeQuery; }, {}, { onClick: () => void; }, {}>>; isDisposed: boolean; queries: ...; rootModuleID: string; }>'.
Types of property 'extraProps' are incompatible.
Type '{} | null' is not assignable to type '{}'.
Type 'null' is not assignable to type '{}'.
    at combineErrorsAndWarnings (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:200:28)
    at runTests (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:192:20)

Full output in the log.

@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:

Something interesting changed - please have a look.

Details

effect

packages/tools/ai-docgen/tsconfig.json

puppeteer

packages/puppeteer-core/tsconfig.json

uglify-js

/mnt/vss/work/1/s/ts_downloads//m/uglify-js/tsconfig.json

  • [NEW] error TS2339: Property 'last_ref' does not exist on type 'never'.
    • /mnt/vss/work/1/s/ts_downloads//m/uglify-js/node_modules/uglify-js/lib/compress.js(2544,35)
  • [MISSING] error TS2322: Type 'false' is not assignable to type 'never'.
    • /mnt/vss/work/1/s/ts_downloads//m/uglify-js/node_modules/uglify-js/lib/compress.js(2544,25)

webpack

tsconfig.json

  • [NEW] error TS2345: Argument of type '[unknown]' is not assignable to parameter of type '[] | [boldQuantity?: boolean | undefined] | [direction?: "child" | "parent" | "sibling" | undefined] | [oversize?: boolean | undefined]'.
  • [NEW] error TS2345: Argument of type 'string | number | boolean | Type' is not assignable to parameter of type 'Type'.

tsconfig.types.json

  • [NEW] error TS2345: Argument of type '[unknown]' is not assignable to parameter of type '[] | [boldQuantity?: boolean | undefined] | [direction?: "child" | "parent" | "sibling" | undefined] | [oversize?: boolean | undefined]'.

tsconfig.types.test.json

@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,466 88,464 -2 (- 0.00%) ~ ~ p=0.000 n=20
Types 79,607 79,570 -37 (- 0.05%) ~ ~ p=0.000 n=20
Memory Used 103,896k (± 0.02%) 111,077k (± 0.04%) 🔻+7,181k (+ 6.91%) 110,925k 111,227k p=0.000 n=20
Memory Allocs 1,262,232 (± 0.01%) 1,382,888 (± 0.01%) 🔻+120,657 (+ 9.56%) 1,382,595 1,383,138 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.023s (± 2.38%) 0.024s (± 2.35%) ~ 0.022s 0.025s p=0.273 n=20
Bind Time 0.008s (± 4.19%) 0.009s (± 6.30%) ~ 0.007s 0.011s p=0.503 n=20
Check Time 0.214s (± 2.44%) 0.238s (± 0.84%) 🔻+0.023s (+10.82%) 0.232s 0.248s p=0.000 n=20
Emit Time 0.142s (± 1.09%) 0.149s (± 0.98%) 🔻+0.007s (+ 5.16%) 0.141s 0.154s p=0.000 n=20
Total Time 0.391s (± 1.34%) 0.422s (± 0.73%) 🔻+0.031s (+ 8.05%) 0.412s 0.437s p=0.000 n=20
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=20
Symbols 586,461 (± 0.01%) 582,012 (± 0.03%) -4,449 (- 0.76%) 581,488 582,966 p=0.000 n=20
Types 241,684 (± 0.00%) 244,833 (± 0.04%) +3,149 (+ 1.30%) 244,649 245,409 p=0.000 n=20
Memory Used 518,997k (± 0.03%) 799,196k (± 0.04%) 🔻+280,200k (+53.99%) 798,221k 801,135k p=0.000 n=20
Memory Allocs 7,793,838 (± 0.11%) 14,777,317 (± 0.08%) 🔻+6,983,478 (+89.60%) 14,743,392 14,830,518 p=0.000 n=20
Config Time 0.009s 0.009s ~ ~ ~ p=1.000 n=20
Parse Time 0.126s (± 4.43%) 0.124s (± 2.06%) ~ 0.116s 0.136s p=0.473 n=20
Bind Time 0.042s (± 9.91%) 0.045s (±11.57%) ~ 0.036s 0.067s p=0.533 n=20
Check Time 0s 0s ~ ~ ~ p=1.000 n=20
Emit Time 0.827s (± 0.92%) 1.358s (± 1.06%) 🔻+0.531s (+64.19%) 1.297s 1.406s p=0.000 n=20
Total Time 1.015s (± 1.00%) 1.547s (± 0.75%) 🔻+0.532s (+52.46%) 1.499s 1.587s p=0.000 n=20
arktype - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 685,920 737,025 🔻+51,105 (+ 7.45%) ~ ~ p=0.000 n=20
Types 939,467 954,543 +15,076 (+ 1.60%) ~ ~ p=0.000 n=20
Memory Used 495,298k (± 0.01%) 568,199k (± 0.01%) 🔻+72,901k (+14.72%) 567,987k 568,454k p=0.000 n=20
Memory Allocs 12,061,856 (± 0.01%) 15,942,771 (± 0.01%) 🔻+3,880,915 (+32.18%) 15,938,341 15,948,882 p=0.000 n=20
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.041s (± 4.12%) 0.042s (± 2.99%) ~ 0.037s 0.047s p=0.793 n=20
Bind Time 0.014s (±10.49%) 0.013s (± 8.24%) ~ 0.011s 0.019s p=0.616 n=20
Check Time 0.883s (± 0.99%) 1.199s (± 0.78%) 🔻+0.316s (+35.81%) 1.158s 1.246s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.966s (± 0.86%) 1.283s (± 0.66%) 🔻+0.317s (+32.79%) 1.253s 1.328s p=0.000 n=20
class-transformer - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 45,376 45,319 -57 (- 0.13%) ~ ~ p=0.000 n=20
Types 7,573 7,219 🟩-354 (- 4.67%) ~ ~ p=0.000 n=20
Memory Used 27,890k (± 0.03%) 30,925k (± 0.02%) 🔻+3,035k (+10.88%) 30,899k 30,943k p=0.000 n=20
Memory Allocs 248,137 (± 0.04%) 267,547 (± 0.05%) 🔻+19,409 (+ 7.82%) 267,126 268,373 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.011s (± 4.90%) 0.011s (± 4.44%) ~ 0.009s 0.013s p=0.870 n=20
Bind Time 0.003s (± 4.63%) 0.003s (± 6.23%) ~ 0.002s 0.004s p=0.381 n=20
Check Time 0.008s (± 5.14%) 0.010s (± 3.52%) 🔻+0.002s (+20.50%) 0.008s 0.011s p=0.000 n=20
Emit Time 0.008s (± 5.95%) 0.010s (± 4.57%) 🔻+0.001s (+17.79%) 0.008s 0.012s p=0.000 n=20
Total Time 0.031s (± 1.77%) 0.035s (± 1.61%) 🔻+0.003s (+ 9.86%) 0.032s 0.036s p=0.000 n=20
effect - native
Errors 12 20 🔻+8 (+66.67%) ~ ~ p=0.000 n=20
Symbols 1,235,115 1,234,949 -166 (- 0.01%) ~ ~ p=0.000 n=20
Types 894,113 890,634 -3,479 (- 0.39%) ~ ~ p=0.000 n=20
Memory Used 939,429k (± 0.03%) 1,015,968k (± 0.01%) 🔻+76,539k (+ 8.15%) 1,015,553k 1,016,675k p=0.000 n=20
Memory Allocs 12,635,077 (± 0.03%) 15,907,879 (± 0.02%) 🔻+3,272,802 (+25.90%) 15,898,929 15,928,234 p=0.000 n=20
Config Time 0.002s 0.002s ~ ~ ~ p=1.000 n=20
Parse Time 0.147s (± 1.86%) 0.149s (± 2.22%) ~ 0.138s 0.174s p=0.357 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 0.865s (± 1.97%) 1.183s (± 0.59%) 🔻+0.318s (+36.79%) 1.163s 1.216s p=0.000 n=20
Emit Time 0.492s (± 1.97%) 0.509s (± 2.29%) +0.017s (+ 3.47%) 0.459s 0.547s p=0.042 n=20
Total Time 1.597s (± 0.81%) 1.934s (± 0.61%) 🔻+0.337s (+21.11%) 1.896s 2.009s p=0.000 n=20
mui-docs - native
Errors 11,405 11,405 ~ ~ ~ p=1.000 n=20
Symbols 3,784,019 3,745,693 -38,326 (- 1.01%) ~ ~ p=0.000 n=20
Types 1,355,974 1,292,461 🟩-63,513 (- 4.68%) ~ ~ p=0.000 n=20
Memory Used 1,769,157k (± 0.06%) 2,355,727k (± 0.06%) 🔻+586,570k (+33.16%) 2,350,729k 2,362,054k p=0.000 n=20
Memory Allocs 25,751,249 (± 0.13%) 46,425,057 (± 0.07%) 🔻+20,673,808 (+80.28%) 46,305,744 46,597,622 p=0.000 n=20
Config Time 0.009s (± 2.52%) 0.009s (± 2.18%) ~ 0.008s 0.009s p=0.716 n=20
Parse Time 0.301s (± 1.40%) 0.300s (± 2.37%) ~ 0.263s 0.329s p=0.836 n=20
Bind Time 0.001s 0.001s (±34.77%) ~ 0.001s 0.005s p=1.000 n=20
Check Time 3.016s (± 0.63%) 4.953s (± 0.87%) 🔻+1.937s (+64.22%) 4.775s 5.186s p=0.000 n=20
Emit Time 0.246s (± 1.33%) 0.252s (± 8.48%) +0.006s (+ 2.23%) 0.225s 0.388s p=0.014 n=20
Total Time 4.079s (± 0.56%) 6.019s (± 0.68%) 🔻+1.940s (+47.57%) 5.929s 6.305s p=0.000 n=20
sentry - native
Errors 2 3 🔻+1 (+50.00%) ~ ~ p=0.000 n=20
Symbols 4,793,245 4,780,779 -12,466 (- 0.26%) ~ ~ p=0.000 n=20
Types 2,606,905 2,536,142 -70,763 (- 2.71%) ~ ~ p=0.000 n=20
Memory Used 2,846,141k (± 0.03%) 3,074,910k (± 0.03%) 🔻+228,769k (+ 8.04%) 3,071,117k 3,078,986k p=0.000 n=20
Memory Allocs 75,140,192 (± 0.36%) 84,474,429 (± 0.31%) 🔻+9,334,237 (+12.42%) 83,951,658 85,589,151 p=0.000 n=20
Config Time 0.026s (± 0.79%) 0.026s (± 0.89%) ~ 0.026s 0.027s p=0.501 n=20
Parse Time 0.518s (± 8.15%) 0.491s (± 4.59%) ~ 0.436s 0.643s p=0.417 n=20
Bind Time 0.176s (±10.76%) 0.178s (±10.44%) ~ 0.133s 0.256s p=0.995 n=20
Check Time 7.021s (± 0.59%) 8.232s (± 0.56%) 🔻+1.211s (+17.25%) 8.060s 8.449s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 7.794s (± 0.74%) 8.984s (± 0.70%) 🔻+1.190s (+15.27%) 8.778s 9.236s p=0.000 n=20
social-app - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 1,883,074 1,905,657 +22,583 (+ 1.20%) ~ ~ p=0.000 n=20
Types 1,158,168 1,165,271 +7,103 (+ 0.61%) ~ ~ p=0.000 n=20
Memory Used 966,839k (± 0.01%) 1,075,252k (± 0.01%) 🔻+108,413k (+11.21%) 1,074,815k 1,075,931k p=0.000 n=20
Memory Allocs 13,509,034 (± 0.22%) 17,764,359 (± 0.25%) 🔻+4,255,325 (+31.50%) 17,692,748 18,046,398 p=0.000 n=20
Config Time 0.008s (± 1.82%) 0.008s (± 1.82%) ~ 0.007s 0.008s p=1.000 n=20
Parse Time 0.180s (± 5.61%) 0.179s (± 5.35%) ~ 0.153s 0.246s p=0.857 n=20
Bind Time 0.050s (±11.47%) 0.045s (± 8.92%) ~ 0.039s 0.077s p=0.118 n=20
Check Time 1.548s (± 1.99%) 2.076s (± 1.68%) 🔻+0.529s (+34.15%) 1.949s 2.238s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 1.804s (± 1.92%) 2.326s (± 1.58%) 🔻+0.522s (+28.91%) 2.198s 2.500s p=0.000 n=20
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 1,184,972 1,186,616 +1,644 (+ 0.14%) ~ ~ p=0.000 n=20
Types 438,959 437,306 -1,653 (- 0.38%) ~ ~ p=0.000 n=20
Memory Used 1,168,821k (± 0.22%) 1,236,045k (± 0.27%) 🔻+67,224k (+ 5.75%) 1,219,892k 1,255,324k p=0.000 n=20
Memory Allocs 47,504,318 (± 0.08%) 54,063,076 (± 0.05%) 🔻+6,558,758 (+13.81%) 53,965,768 54,192,344 p=0.000 n=20
Config Time 0.002s (±15.67%) 0.002s (±12.34%) ~ 0.001s 0.003s p=0.418 n=20
Parse Time 0.140s (± 2.31%) 0.141s (± 1.84%) ~ 0.129s 0.150s p=0.702 n=20
Bind Time 0.000s 0.000s (±208.60%) ~ 0.000s 0.001s p=1.000 n=20
Check Time 0.799s (± 0.52%) 0.942s (± 0.47%) 🔻+0.142s (+17.81%) 0.928s 0.963s p=0.000 n=20
Emit Time 0.139s (± 1.14%) 0.137s (± 0.80%) -0.002s (- 1.47%) 0.131s 0.140s p=0.029 n=20
Total Time 9.331s (± 0.53%) 10.385s (± 0.46%) 🔻+1.055s (+11.30%) 10.236s 10.661s p=0.000 n=20
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 263,511 263,733 +222 (+ 0.08%) ~ ~ p=0.000 n=20
Types 196,116 195,818 -298 (- 0.15%) ~ ~ p=0.000 n=20
Memory Used 223,533k (± 0.02%) 239,287k (± 0.01%) 🔻+15,754k (+ 7.05%) 239,129k 239,421k p=0.000 n=20
Memory Allocs 2,388,520 (± 0.01%) 2,816,004 (± 0.01%) 🔻+427,484 (+17.90%) 2,815,196 2,816,908 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.050s (± 2.96%) 0.051s (± 3.17%) ~ 0.046s 0.058s p=0.930 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 0.368s (± 0.70%) 0.429s (± 0.58%) 🔻+0.061s (+16.54%) 0.422s 0.440s p=0.000 n=20
Emit Time 0.048s (± 5.30%) 0.051s (± 6.28%) ~ 0.042s 0.065s p=0.193 n=20
Total Time 0.494s (± 0.69%) 0.558s (± 0.53%) 🔻+0.064s (+12.93%) 0.548s 0.573s p=0.000 n=20
t3code-server - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 4,350,661 4,283,060 -67,601 (- 1.55%) ~ ~ p=0.000 n=20
Types 3,040,644 3,016,451 -24,193 (- 0.80%) ~ ~ p=0.000 n=20
Memory Used 2,417,400k (± 0.02%) 2,720,850k (± 0.02%) 🔻+303,450k (+12.55%) 2,718,807k 2,724,832k p=0.000 n=20
Memory Allocs 37,173,527 (± 0.11%) 54,364,231 (± 0.06%) 🔻+17,190,703 (+46.24%) 54,296,137 54,552,967 p=0.000 n=20
Config Time 0.003s 0.003s (± 3.54%) ~ 0.002s 0.003s p=1.000 n=20
Parse Time 0.252s (± 1.91%) 0.255s (± 1.67%) ~ 0.241s 0.274s p=0.213 n=20
Bind Time 0.083s (± 9.76%) 0.087s (± 9.44%) ~ 0.073s 0.139s p=0.439 n=20
Check Time 5.974s (± 1.72%) 8.439s (± 1.55%) 🔻+2.465s (+41.25%) 7.958s 8.722s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 6.323s (± 1.67%) 8.795s (± 1.54%) 🔻+2.472s (+39.10%) 8.285s 9.112s p=0.000 n=20
tanstack-router - native
Errors 1 1 ~ ~ ~ p=1.000 n=20
Symbols 571,756 570,271 -1,485 (- 0.26%) ~ ~ p=0.000 n=20
Types 397,689 391,059 -6,630 (- 1.67%) ~ ~ p=0.000 n=20
Memory Used 326,453k (± 0.02%) 360,984k (± 0.02%) 🔻+34,531k (+10.58%) 360,761k 361,214k p=0.000 n=20
Memory Allocs 4,339,125 (± 0.20%) 5,432,212 (± 0.14%) 🔻+1,093,088 (+25.19%) 5,414,800 5,461,739 p=0.000 n=20
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.041s (± 4.12%) 0.040s (± 4.57%) ~ 0.034s 0.047s p=0.488 n=20
Bind Time 0.013s (±11.55%) 0.012s (± 8.91%) ~ 0.010s 0.019s p=0.913 n=20
Check Time 0.498s (± 0.65%) 0.647s (± 0.63%) 🔻+0.149s (+29.93%) 0.631s 0.665s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.570s (± 0.80%) 0.719s (± 0.56%) 🔻+0.149s (+26.12%) 0.704s 0.736s p=0.000 n=20
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=20
Symbols 231,616 231,759 +143 (+ 0.06%) ~ ~ p=0.000 n=20
Types 181,195 181,047 -148 (- 0.08%) ~ ~ p=0.000 n=20
Memory Used 193,023k (± 0.01%) 207,199k (± 0.01%) 🔻+14,176k (+ 7.34%) 207,099k 207,341k p=0.000 n=20
Memory Allocs 1,310,342 (± 0.02%) 1,688,280 (± 0.02%) 🔻+377,938 (+28.84%) 1,687,127 1,689,848 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.049s (± 3.79%) 0.049s (± 3.83%) ~ 0.044s 0.058s p=0.692 n=20
Bind Time 0.024s (± 4.74%) 0.023s (± 4.89%) ~ 0.019s 0.027s p=0.138 n=20
Check Time 0.322s (± 0.94%) 0.380s (± 1.11%) 🔻+0.058s (+18.02%) 0.369s 0.405s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.401s (± 0.96%) 0.459s (± 1.14%) 🔻+0.058s (+14.36%) 0.441s 0.483s p=0.000 n=20
vscode - native
Errors 11 12 🔻+1 (+ 9.09%) ~ ~ p=0.000 n=20
Symbols 7,581,393 7,409,825 -171,568 (- 2.26%) ~ ~ p=0.000 n=20
Types 4,453,103 4,223,626 🟩-229,477 (- 5.15%) ~ ~ p=0.000 n=20
Memory Used 5,238,870k (± 0.01%) 5,410,766k (± 0.02%) +171,895k (+ 3.28%) 5,407,037k 5,413,361k p=0.000 n=20
Memory Allocs 57,460,124 (± 0.01%) 68,502,245 (± 0.02%) 🔻+11,042,120 (+19.22%) 68,476,208 68,590,077 p=0.000 n=20
Config Time 0.038s (± 1.78%) 0.038s (± 1.20%) ~ 0.036s 0.039s p=0.605 n=20
Parse Time 0.938s (± 1.31%) 0.947s (± 2.19%) ~ 0.844s 1.027s p=0.465 n=20
Bind Time 0.351s (± 7.68%) 0.362s (± 9.33%) ~ 0.292s 0.567s p=0.952 n=20
Check Time 7.945s (± 1.56%) 9.364s (± 1.45%) 🔻+1.419s (+17.86%) 8.645s 9.814s p=0.000 n=20
Emit Time 2.970s (± 5.87%) 3.369s (± 4.07%) 🔻+0.399s (+13.45%) 2.990s 4.186s p=0.000 n=20
Total Time 12.303s (± 1.97%) 14.143s (± 1.64%) 🔻+1.840s (+14.96%) 13.304s 15.144s p=0.000 n=20
webpack - native
Errors 612 620 +8 (+ 1.31%) ~ ~ p=0.000 n=20
Symbols 925,190 1,082,647 🔻+157,457 (+17.02%) ~ ~ p=0.000 n=20
Types 643,199 2,133,243 🔻+1,490,044 (+231.66%) ~ ~ p=0.000 n=20
Memory Used 697,711k (± 0.02%) 1,371,751k (± 0.01%) 🔻+674,040k (+96.61%) 1,371,408k 1,372,322k p=0.000 n=20
Memory Allocs 6,473,690 (± 0.05%) 47,254,840 (± 0.01%) 🔻+40,781,151 (+629.95%) 47,247,152 47,271,226 p=0.000 n=20
Config Time 0.004s 0.004s ~ ~ ~ p=1.000 n=20
Parse Time 0.143s (± 3.09%) 0.147s (± 3.62%) ~ 0.126s 0.170s p=0.298 n=20
Bind Time 0.049s (±12.18%) 0.046s (± 9.74%) ~ 0.039s 0.072s p=0.825 n=20
Check Time 0.982s (± 0.54%) 72.903s (± 1.96%) 🔻+71.921s (+7,322.82%) 66.626s 79.005s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 1.201s (± 0.76%) 73.124s (± 1.96%) 🔻+71.923s (+5,988.87%) 66.840s 79.236s p=0.000 n=20
xstate-main - native
Errors 0 1 🔻+1 (+ ∞%) ~ ~ p=0.000 n=20
Symbols 640,490 856,593 🔻+216,103 (+33.74%) ~ ~ p=0.000 n=20
Types 387,984 457,702 🔻+69,718 (+17.97%) ~ ~ p=0.000 n=20
Memory Used 350,159k (± 0.02%) 455,995k (± 0.01%) 🔻+105,835k (+30.22%) 455,690k 456,211k p=0.000 n=20
Memory Allocs 3,968,869 (± 0.10%) 11,780,642 (± 0.03%) 🔻+7,811,773 (+196.83%) 11,766,097 11,790,998 p=0.000 n=20
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.064s (± 4.85%) 0.064s (± 5.34%) ~ 0.054s 0.082s p=0.835 n=20
Bind Time 0.020s (±11.79%) 0.021s (± 9.16%) ~ 0.017s 0.032s p=0.439 n=20
Check Time 0.406s (± 1.92%) 0.909s (± 1.89%) 🔻+0.503s (+123.95%) 0.875s 1.034s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.496s (± 1.97%) 1.000s (± 2.01%) 🔻+0.504s (+101.72%) 0.962s 1.143s p=0.000 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

@jakebailey

Copy link
Copy Markdown
Member Author

Well, that's a little bleak.

@jakebailey

Copy link
Copy Markdown
Member Author

Not sure why top400 didn't come back either

Checker results should not depend on which files were checked first,
or on which types an editor happened to ask for before diagnostics
were requested. Tests had no way to show such dependence, so fixes for
it could only be described, not demonstrated.

The harness-only checkOrder option queries the checker in a different
order: files in reverse, each file in its own program, or every
expression's type and symbol before any diagnostics. Listing several
orders produces a baseline for each, so order dependence shows up as
differing baselines.
The checkOrder option only tries a few fixed orders over whole files,
but results can depend on which single query a checker answers first,
as when an editor asks for the type of one node before anything else
is checked. Such dependence is hard to find by hand and easy to
reintroduce.

With TS_CHECK_ORDER_FUZZ=n, each test is checked again n times in fresh
programs that first answer a seeded random selection of type, symbol,
and diagnostics queries. Any change in diagnostics or in the type or
symbol of a node fails the test with the seed and a minimized list of
queries that reproduces it. The fuzzer is off by default, so it does
not slow the normal suite.
Asking the checker for types and symbols before requesting diagnostics
changes the diagnostics and types reported for these tests. Recording
them in that order too shows which later changes make the results
independent of what was asked first.
These tests exercise checker results that can depend on the order in
which declarations, files, and relations are checked: variance
measurement cycles, relation caching under recursion and depth
limits, instantiation limits, contextual re-checks, and deferred type
reference cycles.

Recording the current baselines makes later changes to make checking
order independent show up as reviewable baseline diffs.
Variance measured through a cycle of recursive references used to
depend on which type in the cycle was measured first, so reordering
declarations or assignments changed which assignments were errors.
These cases cover cycles through interfaces, type aliases, callbacks,
and nested compositions, alongside annotated and structurally measured
types whose results should not change.
The errors for a getter and setter that disagree on abstractness or
accessibility were reported on both names by whichever accessor was
checked first, guarded by a flag on the getter. When that happened
during a query rather than a full check, the flag was set without the
errors being reported. Since the errors only depend on the modifiers,
each accessor now reports the error on its own name with no state,
which yields the same set of errors in any order.
The type parameters of a type alias are resolved along with its
declared type, but some readers took them from the links without
resolving the declared type first, relying on it having been resolved
earlier. Reading them through an accessor that resolves the declared
type makes the dependency explicit, so the result does not depend on
what was resolved before.
checkAssertion runs in several check modes, such as when a call is
first checked without its context sensitive arguments, and each run
overwrote the operand type kept for the deferred comparability check.
That check used whichever was stored last, so its result depended on
the order in which the assertion was checked.

The deferred check now uses the cached normal type of the operand. The
assertion itself only needs the operand type for `as const`, and the
operand of a non-const assertion is contextually typed by the asserted
type alone, so in any check mode the assertion computes the cached
type the deferred check will read, with inference for an enclosing
call hidden from the operand. This is the result the deferred check
would produce on its own, and checks each operand once rather than
again with fresh flow analysis in the deferred check.
The type of a destructured parameter's binding elements depended on
whether the parameter's type happened to be cached already. For
example, in non-strict mode

    (({ [a()?.d]: c = "" }) => {})();

reported TS2537 when 'c' was queried before the IIFE call resolved
the parameter (its declared type is the undefined widening type),
but not otherwise. Conversely, in

    f7({ a: {} });
    function f7({ a: { x = 0, y = 0 } } = { a: {} }) {}

calling f7 first made 'x' and 'y' errors of type any.

Make the choice depend only on the declaration. Parameters of
context-sensitive functions take their type from contextual
assignment, so ask for the parameter's type. Everything else uses
the type derived from the declaration, as it did when nothing was
cached. Asking for the parameter's type unconditionally instead
introduces circularities in patterns whose initializers reference
sibling elements.
Asking for the type of a context-sensitive function's parameter can
resolve the enclosing call, which assigns the parameter its
contextual type from the inference in progress. The first query
nevertheless returned the type it computed itself from the final
signature, while every later query returned the assigned type. In

    declare function fun<T>(g: (x: T) => T, h: (y: T) => T, x: T): T;
    fun((Math.random() < 0.5 ? (x => x) : (x => undefined)), x => x, 10);

the last 'x' was number when the call was checked first, but any
when 'x' was queried first and its result was cached.

Return the assigned type whenever one exists, so that the first
query agrees with the rest, as the original comment intended.
When resolving a function expression's members reaches the function
again through its enclosing call, the contextual check sees an empty
signature list and gives up, yet it left the node marked as context
checked. Whichever query got there first therefore decided whether the
function's parameters were ever contextually typed, and diagnostics
such as implicit any errors could be lost depending on check order.

Leave the node unchecked in that case so a later request performs the
check, and have the deferred function check request it, so that the
check is performed at least once whichever query reached it first.
Generic calls nested in the arguments of other generic calls, or in
context sensitive functions passed to them, depend on the enclosing
call for their contextual type and parameter types, and the enclosing
call infers from them in turn. When the inner call was queried first,
it was already marked as resolving by the time its contextual type
resolved the enclosing call, so the enclosing inference saw a
placeholder and both calls cached results that a check in source order
never produces.

Computing the contextual type of a call nested in an argument of an
enclosing call before resolving it resolves the enclosing call first,
as source order does. Other contexts are not resolved ahead of time,
since computing them may evaluate expressions that checking does not,
such as the target of a destructuring assignment.
Asking for the symbol of a property access that hits an index signature
stored the index symbol as the access's resolved symbol. Checking a
delete expression reads that link to decide whether the operand must be
optional, so a prior symbol query turned `delete a.x` on an index
signature into an error that a plain check does not report.

The type of the index symbol at such an access, which hovers show, is
found by comparing it to the symbol the access resolved to, so that
comparison now looks the index symbol up again rather than reading it
from links.
A context-sensitive function's signature takes the type parameters of
a generic contextual signature, and its parameters their types, when
the function is contextually checked. Anything reading the signature
before then saw it incomplete and cached what it derived from it. Type
aliases in the body read the type parameters as outer type parameters,
so querying such an alias first resolved its conditional types eagerly.
In

    declare function f(fun: <T>(t: T) => void): void
    f(function self(t) {
        const s = self;
        type P = Parameters<typeof s>;
    });

P was [t: unknown] when the call was checked first, but [t: T] when P
was asked for first, since s then had the uncontextual signature.

Split out assigning the contextual parameter types, which completes
the signature, from the rest of the contextual check, and have every
way to obtain the signature request it: the type of the function's
symbol, before anything resolves its members, and the signature of its
declaration. The rest of the check, inferring the return type and
checking the signature, remains for checking the function itself.

Contextual typing can reach the enclosing call while the signature is
being created, so keep the signature created there rather than replace
the one that was contextually typed. This also makes it unnecessary to
leave a function unchecked when its members are found being resolved.
A single signature type produced by higher order inference is
instantiated with the full mapper combined in, since its signature can
reference type parameters other than the outer type parameters of its
declaration. The instantiation cache was keyed only by the mapped outer
type parameters, so two instantiations differing in another type
parameter (here the this type) shared whichever result was computed
first. Which property access was checked first therefore decided the
type of both, and checking `outer.log` gave it the type of `inner.log`
contrary to the test's expectation.
Explaining why a name failed to resolve looks up other symbols, for
example to find a spelling suggestion, and that can resolve aliases.
When the failed name was the target of an alias, the suggestion lookup
re-entered the alias being resolved, or skipped it, depending on which
aliases were already in progress. In declarationEmitUnknownImport that
decided whether two "Circular definition of import alias" errors were
reported: they appeared when the import was checked first, and not
when the export specifier was resolved first.

Defer the explanation until no resolution is in progress, so it only
observes finished results. The circularity errors that were artifacts
of the suggestion lookup are no longer reported.
When one reference hit the flow analysis depth limit, flow analysis
was disabled for every later reference in the same function or module
body. The type of a reference then depended on whether another
reference in the body had been analyzed before it.

Each reference now gives up only when its own analysis hits the limit,
so its type is the one it would get if it were analyzed first.
Every computation with effects keeps a memoEffects until a check
replays it, and when nothing checks again, such as when emitting after
checking, those of the whole program stay live. Few have reference
marks or cycle heads, so moving them to a side struct shrinks every
node from 128 to 80 bytes (seen in angular, about 60MB less).
linkState wrapped the effects of the computation that cached a result
in a set of deps even when it was the only one, though replaying a set
holding only f replays f the same way. The state now points at f until
a second computation caches the result, which then gets a set rather
than adding to the effects of f, shared with everything else depending
on it (seen in angular, about 30MB less).
Most results with a memo state only have pending effects, and every
state stays live until a check reads it, so storing the rare errors
list behind a pointer halves the state (seen in angular, about 20MB
less).
A computation with no effects of its own that observed only one result
computed at the same node replays exactly what that result does, so
the result keeps those effects as its own rather than a node holding
one edge to them (seen in angular, about 10MB less).
resolvingIndex scanned every in-progress entry of a memo map to find a
key, which is quadratic when many entries of one map are in progress at
once, as in deeply nested variance measurements. Past a small number of
in-progress entries, count them by key so that a lookup for a key that
is not in progress is constant time.

(seen in nested variance stress)
When a variance measurement re-entered one already in progress, the
inner measurement restarted from the canonical (smallest) type of the
cycle with the stack hidden. With cycles nested in cycles, each restart
re-measured every type still in progress, so the work multiplied with
the nesting depth.

Now re-entry instead records the lowest stack index it reached, as in
Tarjan's algorithm, and returns provisional variances. When a
measurement finishes as the root of its strongly connected component
and the component's canonical type is not the root, what was cached
since the root began is discarded and the canonical type is measured
once with the stack hidden; the root then adopts its result. The result
is what main computes when the canonical type is checked first, and
each component is measured at most about twice.

The elaboration in varianceCircularConsistency now goes through the
'queries' property again, matching main and TypeScript 6.0.

(seen in nested variance stress)
When a computation re-entered one in progress, memoCycle made every
computation above it depend on it, stopping only at one that already
depended on that same head. With cycles nested in cycles, re-entries
reach many different heads, so each walked most of the stack and every
computation gained a dependency per head.

A computation in progress above a cycle head becomes part of the head's
effects, so depending on the lowest head covers every head above it.
Record the head's index with each dependency, add one only for a lower
head than the computation already depends on, and stop the walk at the
first computation that depends on this head or one below it.

(seen in nested variance stress)
Relating type references and aliases now asks whether the target's
variances are being measured, which scanned the whole variance stack on
every comparison made during a measurement. Index the stack by symbol,
restoring a symbol's previous index when its measurement ends, so that
a measurement hidden with the rest of the stack is still not found.

(seen in nested variance stress)
isTypeRelatedTo reads the cached result for the relation key before it
starts a comparison, and beginTop read it again in case a comparison
made in between cached one. Most comparisons cache nothing in between,
so memoMap now counts its writes, and beginTop reads the result again
only if the relation was written since the caller read it. This avoids
a map lookup per comparison that reaches recursiveTypeRelatedTo.

(seen in VS Code check time)
@jakebailey

Copy link
Copy Markdown
Member Author

TypeScript Bot (@typescript-bot) test it

@typescript-automation

typescript-automation Bot commented Nov 2, 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

@typescript-automation

Copy link
Copy Markdown
Contributor

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

There were interesting changes:

Branch only errors: d3-selection

Package: d3-selection

Branch error:

Project scope: tsconfig.json

Error: types/d3-selection/d3-selection-tests.ts:1502:9
TypeScript@local compile error TS2769:
No overload matches this call.
The last overload gave the following error.
Argument of type '(enter: Selection<EnterElement, number, HTMLElement, unknown>) => TransitionLike<HTMLParagraphElement, number>' is not assignable to parameter of type 'string | ((elem: Selection<EnterElement, number, HTMLElement, unknown>) => Selection<BaseType, number, HTMLElement, unknown> | TransitionLike<...>)'.
Type '(enter: Selection<EnterElement, number, HTMLElement, unknown>) => TransitionLike<HTMLParagraphElement, number>' is not assignable to type '(elem: Selection<EnterElement, number, HTMLElement, unknown>) => Selection<BaseType, number, HTMLElement, unknown> | TransitionLike<...>'.
Type 'TransitionLike<HTMLParagraphElement, number>' is not assignable to type 'Selection<BaseType, number, HTMLElement, unknown> | TransitionLike<HTMLElement, number>'.
Type 'TransitionLike<HTMLParagraphElement, number>' is not assignable to type 'TransitionLike<HTMLElement, number>'.
The types returned by 'selection().merge' are incompatible between these types.
Type '(other: Selection<HTMLParagraphElement, number, any, any> | TransitionLike<HTMLParagraphElement, number>) => Selection<...>' is not assignable to type '(other: Selection<HTMLElement, number, any, any> | TransitionLike<HTMLElement, number>) => Selection<HTMLElement, number, any, any>'.
Types of parameters 'other' and 'other' are incompatible.
Type 'Selection<HTMLElement, number, any, any> | TransitionLike<HTMLElement, number>' is not assignable to type 'Selection<HTMLParagraphElement, number, any, any> | TransitionLike<HTMLParagraphElement, number>'.
Type 'Selection<HTMLElement, number, any, any>' is not assignable to type 'Selection<HTMLParagraphElement, number, any, any> | TransitionLike<HTMLParagraphElement, number>'.
Type 'Selection<HTMLElement, number, any, any>' is not assignable to type 'Selection<HTMLParagraphElement, number, any, any>'.
Types of property 'select' are incompatible.
Type '{ <DescElement extends BaseType>(selector: string): import("/mnt/vss/_work/1/s/DefinitelyTyped/types/d3-selection/index").Selection<DescElement, number, any, any>; <DescElement extends BaseType>(selector: null): import("/mnt/vss/_work/1/s/DefinitelyTyped/types/d3-selection/index").Selection<...>; <DescElement extend...' is not assignable to type '{ <DescElement extends BaseType>(selector: string): import("/mnt/vss/_work/1/s/DefinitelyTyped/types/d3-selection/index").Selection<DescElement, number, any, any>; <DescElement extends BaseType>(selector: null): import("/mnt/vss/_work/1/s/DefinitelyTyped/types/d3-selection/index").Selection<...>; <DescElement extend...'. Two different types with this name exist, but they are unrelated.
Types of parameters 'selector' and 'selector' are incompatible.
Types of parameters 'groups' and 'groups' are incompatible.
Type 'HTMLElement[] | ArrayLike<HTMLElement>' is not assignable to type 'HTMLParagraphElement[] | ArrayLike<HTMLParagraphElement>'.
Type 'HTMLElement[]' is not assignable to type 'HTMLParagraphElement[] | ArrayLike<HTMLParagraphElement>'.
Type 'HTMLElement[]' is not assignable to type 'HTMLParagraphElement[]'.
Property 'align' is missing in type 'HTMLElement' but required in type 'HTMLParagraphElement'.
    at combineErrorsAndWarnings (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:200:28)
    at runTests (/mnt/vss/_work/1/s/DefinitelyTyped-tools/packages/dtslint/dist/index.js:192:20)

Full output in the log.

@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:

Something interesting changed - please have a look.

Details

effect

packages/tools/ai-docgen/tsconfig.json

uglify-js

/mnt/vss/work/1/s/ts_downloads//m/uglify-js/tsconfig.json

  • [NEW] error TS2339: Property 'last_ref' does not exist on type 'never'.
    • /mnt/vss/work/1/s/ts_downloads//m/uglify-js/node_modules/uglify-js/lib/compress.js(2544,35)
  • [MISSING] error TS2322: Type 'false' is not assignable to type 'never'.
    • /mnt/vss/work/1/s/ts_downloads//m/uglify-js/node_modules/uglify-js/lib/compress.js(2544,25)

webpack

tsconfig.json

  • [NEW] error TS2345: Argument of type 'string | number | boolean | Type' is not assignable to parameter of type 'Type'.

@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,466 88,464 -2 (- 0.00%) ~ ~ p=0.000 n=20
Types 79,607 79,570 -37 (- 0.05%) ~ ~ p=0.000 n=20
Memory Used 107,486k (± 0.03%) 109,973k (± 0.03%) +2,487k (+ 2.31%) 109,890k 110,115k p=0.000 n=20
Memory Allocs 1,262,189 (± 0.01%) 1,299,340 (± 0.01%) +37,151 (+ 2.94%) 1,299,023 1,300,141 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.023s (± 3.58%) 0.023s (± 2.35%) ~ 0.021s 0.026s p=0.176 n=20
Bind Time 0.008s (± 7.08%) 0.008s (± 4.74%) ~ 0.007s 0.010s p=0.273 n=20
Check Time 0.212s (± 0.71%) 0.225s (± 0.56%) 🔻+0.012s (+ 5.82%) 0.220s 0.229s p=0.000 n=20
Emit Time 0.132s (± 0.74%) 0.137s (± 1.54%) +0.005s (+ 3.92%) 0.131s 0.149s p=0.000 n=20
Total Time 0.378s (± 0.51%) 0.396s (± 0.50%) 🔻+0.018s (+ 4.80%) 0.389s 0.405s p=0.000 n=20
angular-1 - native
Errors 3 3 ~ ~ ~ p=1.000 n=20
Symbols 586,553 580,828 -5,725 (- 0.98%) ~ ~ p=0.000 n=20
Types 241,682 238,914 -2,768 (- 1.15%) ~ ~ p=0.000 n=20
Memory Used 519,724k (± 0.02%) 716,013k (± 0.01%) 🔻+196,289k (+37.77%) 715,769k 716,530k p=0.000 n=20
Memory Allocs 7,791,160 (± 0.13%) 13,765,813 (± 0.06%) 🔻+5,974,654 (+76.69%) 13,751,894 13,808,030 p=0.000 n=20
Config Time 0.008s (± 1.77%) 0.008s (± 1.30%) ~ 0.008s 0.009s p=1.000 n=20
Parse Time 0.121s (± 2.39%) 0.123s (± 4.17%) ~ 0.111s 0.151s p=0.846 n=20
Bind Time 0.042s (± 8.87%) 0.042s (± 8.77%) ~ 0.035s 0.062s p=0.749 n=20
Check Time 0s 0s ~ ~ ~ p=1.000 n=20
Emit Time 0.627s (± 0.70%) 1.046s (± 0.59%) 🔻+0.419s (+66.79%) 1.025s 1.077s p=0.000 n=20
Total Time 0.811s (± 0.63%) 1.232s (± 0.59%) 🔻+0.422s (+51.98%) 1.199s 1.252s p=0.000 n=20
arktype - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 685,920 729,709 🔻+43,789 (+ 6.38%) ~ ~ p=0.000 n=20
Types 939,467 951,582 +12,115 (+ 1.29%) ~ ~ p=0.000 n=20
Memory Used 495,337k (± 0.01%) 547,387k (± 0.01%) 🔻+52,050k (+10.51%) 547,088k 547,674k p=0.000 n=20
Memory Allocs 12,062,573 (± 0.01%) 14,747,181 (± 0.01%) 🔻+2,684,608 (+22.26%) 14,743,448 14,753,472 p=0.000 n=20
Config Time 0.001s (±18.96%) 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.044s (± 8.00%) 0.042s (± 3.41%) ~ 0.037s 0.051s p=0.308 n=20
Bind Time 0.014s (± 7.09%) 0.014s (± 9.54%) ~ 0.012s 0.021s p=0.313 n=20
Check Time 0.932s (± 1.14%) 1.127s (± 0.76%) 🔻+0.196s (+20.98%) 1.102s 1.162s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 1.020s (± 1.09%) 1.216s (± 0.82%) 🔻+0.196s (+19.21%) 1.189s 1.274s p=0.000 n=20
class-transformer - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 45,376 45,319 -57 (- 0.13%) ~ ~ p=0.000 n=20
Types 7,573 7,219 🟩-354 (- 4.67%) ~ ~ p=0.000 n=20
Memory Used 27,899k (± 0.03%) 28,301k (± 0.02%) +402k (+ 1.44%) 28,277k 28,327k p=0.000 n=20
Memory Allocs 248,126 (± 0.04%) 253,345 (± 0.06%) +5,220 (+ 2.10%) 252,576 253,950 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.012s (± 3.60%) 0.011s (± 4.22%) ~ 0.010s 0.013s p=0.137 n=20
Bind Time 0.003s (± 9.29%) 0.003s (±11.26%) ~ 0.002s 0.005s p=0.705 n=20
Check Time 0.009s (± 5.49%) 0.009s (± 5.04%) ~ 0.008s 0.011s p=0.081 n=20
Emit Time 0.008s (± 6.55%) 0.009s (± 8.65%) 🔻+0.001s (+15.58%) 0.007s 0.012s p=0.016 n=20
Total Time 0.032s (± 2.51%) 0.034s (± 3.51%) ~ 0.030s 0.039s p=0.050 n=20
effect - native
Errors 12 20 🔻+8 (+66.67%) ~ ~ p=0.000 n=20
Symbols 1,235,115 1,233,517 -1,598 (- 0.13%) ~ ~ p=0.000 n=20
Types 894,113 887,718 -6,395 (- 0.72%) ~ ~ p=0.000 n=20
Memory Used 950,024k (± 0.02%) 977,854k (± 0.02%) +27,830k (+ 2.93%) 977,190k 979,071k p=0.000 n=20
Memory Allocs 12,636,275 (± 0.02%) 13,144,104 (± 0.06%) 🔻+507,829 (+ 4.02%) 13,130,650 13,207,373 p=0.000 n=20
Config Time 0.002s (± 5.09%) 0.002s ~ ~ ~ p=1.000 n=20
Parse Time 0.147s (± 1.25%) 0.148s (± 1.67%) ~ 0.136s 0.159s p=0.515 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 0.887s (± 1.50%) 1.006s (± 1.06%) 🔻+0.119s (+13.43%) 0.977s 1.061s p=0.000 n=20
Emit Time 0.490s (± 1.48%) 0.497s (± 2.04%) ~ 0.439s 0.528s p=0.163 n=20
Total Time 1.616s (± 0.82%) 1.745s (± 0.65%) 🔻+0.129s (+ 7.96%) 1.698s 1.785s p=0.000 n=20
mui-docs - native
Errors 11,405 11,405 ~ ~ ~ p=1.000 n=20
Symbols 3,784,019 3,718,606 -65,413 (- 1.73%) ~ ~ p=0.000 n=20
Types 1,355,974 1,263,453 🟩-92,521 (- 6.82%) ~ ~ p=0.000 n=20
Memory Used 1,769,192k (± 0.04%) 1,931,850k (± 0.07%) 🔻+162,658k (+ 9.19%) 1,925,221k 1,936,043k p=0.000 n=20
Memory Allocs 25,725,146 (± 0.11%) 26,424,518 (± 0.10%) +699,372 (+ 2.72%) 26,329,545 26,530,430 p=0.000 n=20
Config Time 0.008s (± 1.77%) 0.008s (± 1.30%) ~ 0.008s 0.009s p=1.000 n=20
Parse Time 0.285s (± 1.55%) 0.284s (± 2.70%) ~ 0.263s 0.333s p=0.449 n=20
Bind Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Check Time 2.968s (± 0.61%) 3.153s (± 0.48%) 🔻+0.185s (+ 6.23%) 3.089s 3.225s p=0.000 n=20
Emit Time 0.241s (± 0.90%) 0.267s (± 7.40%) 🔻+0.026s (+10.78%) 0.235s 0.352s p=0.006 n=20
Total Time 3.985s (± 0.44%) 4.199s (± 0.60%) 🔻+0.214s (+ 5.37%) 4.137s 4.320s p=0.000 n=20
sentry - native
Errors 2 2 ~ ~ ~ p=1.000 n=20
Symbols 4,793,245 4,722,031 -71,214 (- 1.49%) ~ ~ p=0.000 n=20
Types 2,606,905 2,502,971 🟩-103,934 (- 3.99%) ~ ~ p=0.000 n=20
Memory Used 2,846,533k (± 0.04%) 3,030,999k (± 0.03%) 🔻+184,466k (+ 6.48%) 3,029,069k 3,034,903k p=0.000 n=20
Memory Allocs 75,044,801 (± 0.27%) 77,314,173 (± 0.16%) +2,269,372 (+ 3.02%) 76,952,853 77,891,713 p=0.000 n=20
Config Time 0.025s (± 0.97%) 0.024s (± 0.71%) -0.000s (- 1.63%) 0.024s 0.025s p=0.019 n=20
Parse Time 0.460s (± 5.58%) 0.471s (± 4.79%) ~ 0.429s 0.636s p=0.092 n=20
Bind Time 0.161s (±10.68%) 0.150s (±10.07%) ~ 0.123s 0.223s p=0.524 n=20
Check Time 6.430s (± 0.44%) 7.079s (± 0.33%) 🔻+0.649s (+10.09%) 6.991s 7.157s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 7.129s (± 0.44%) 7.775s (± 0.46%) 🔻+0.646s (+ 9.06%) 7.678s 7.895s p=0.000 n=20
social-app - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 1,883,074 1,897,780 +14,706 (+ 0.78%) ~ ~ p=0.000 n=20
Types 1,158,168 1,160,495 +2,327 (+ 0.20%) ~ ~ p=0.000 n=20
Memory Used 966,807k (± 0.02%) 1,031,339k (± 0.02%) 🔻+64,533k (+ 6.67%) 1,030,791k 1,032,137k p=0.000 n=20
Memory Allocs 13,505,156 (± 0.18%) 14,648,634 (± 0.22%) 🔻+1,143,478 (+ 8.47%) 14,586,982 14,879,071 p=0.000 n=20
Config Time 0.007s (± 1.48%) 0.007s ~ ~ ~ p=1.000 n=20
Parse Time 0.153s (± 2.12%) 0.151s (± 2.66%) ~ 0.139s 0.169s p=0.317 n=20
Bind Time 0.044s (± 9.69%) 0.045s (±11.27%) ~ 0.035s 0.071s p=0.995 n=20
Check Time 1.386s (± 0.62%) 1.614s (± 0.61%) 🔻+0.228s (+16.48%) 1.581s 1.674s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 1.609s (± 0.46%) 1.836s (± 0.64%) 🔻+0.227s (+14.12%) 1.796s 1.904s p=0.000 n=20
strada-build-src - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 1,184,972 1,186,611 +1,639 (+ 0.14%) ~ ~ p=0.000 n=20
Types 438,959 437,305 -1,654 (- 0.38%) ~ ~ p=0.000 n=20
Memory Used 1,168,553k (± 0.28%) 1,183,695k (± 0.28%) +15,142k (+ 1.30%) 1,167,793k 1,195,655k p=0.000 n=20
Memory Allocs 47,548,231 (± 0.10%) 49,026,736 (± 0.10%) +1,478,505 (+ 3.11%) 48,884,066 49,186,950 p=0.000 n=20
Config Time 0.002s (±16.91%) 0.002s (±18.87%) ~ 0.000s 0.002s p=0.149 n=20
Parse Time 0.138s (± 1.83%) 0.138s (± 1.90%) ~ 0.129s 0.153s p=0.825 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 0.789s (± 0.34%) 0.865s (± 0.32%) 🔻+0.076s (+ 9.67%) 0.857s 0.876s p=0.000 n=20
Emit Time 0.139s (± 1.46%) 0.136s (± 1.14%) -0.003s (- 1.84%) 0.132s 0.146s p=0.015 n=20
Total Time 9.160s (± 0.36%) 9.800s (± 0.32%) 🔻+0.640s (+ 6.99%) 9.677s 9.898s p=0.000 n=20
strada-compiler - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 263,511 263,728 +217 (+ 0.08%) ~ ~ p=0.000 n=20
Types 196,116 195,816 -300 (- 0.15%) ~ ~ p=0.000 n=20
Memory Used 223,539k (± 0.03%) 231,308k (± 0.02%) +7,769k (+ 3.48%) 231,177k 231,451k p=0.000 n=20
Memory Allocs 2,389,789 (± 0.02%) 2,498,136 (± 0.01%) 🔻+108,348 (+ 4.53%) 2,496,500 2,499,995 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.049s (± 3.34%) 0.049s (± 3.53%) ~ 0.045s 0.056s p=0.710 n=20
Bind Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Check Time 0.381s (± 0.77%) 0.419s (± 0.56%) 🔻+0.038s (+ 9.94%) 0.409s 0.428s p=0.000 n=20
Emit Time 0.050s (± 6.62%) 0.056s (± 5.05%) 🔻+0.006s (+11.50%) 0.044s 0.064s p=0.004 n=20
Total Time 0.509s (± 0.77%) 0.553s (± 0.61%) 🔻+0.044s (+ 8.64%) 0.542s 0.568s p=0.000 n=20
t3code-server - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 4,350,661 4,276,244 -74,417 (- 1.71%) ~ ~ p=0.000 n=20
Types 3,040,644 3,011,629 -29,015 (- 0.95%) ~ ~ p=0.000 n=20
Memory Used 2,417,668k (± 0.02%) 2,525,133k (± 0.03%) 🔻+107,466k (+ 4.45%) 2,523,299k 2,529,914k p=0.000 n=20
Memory Allocs 37,165,161 (± 0.05%) 40,033,821 (± 0.09%) 🔻+2,868,660 (+ 7.72%) 39,934,949 40,188,717 p=0.000 n=20
Config Time 0.003s (± 3.54%) 0.003s (± 9.34%) 🟩-0.000s (-13.56%) 0.002s 0.003s p=0.008 n=20
Parse Time 0.247s (± 1.96%) 0.245s (± 1.85%) ~ 0.230s 0.262s p=0.533 n=20
Bind Time 0.080s (± 9.08%) 0.089s (±10.99%) ~ 0.072s 0.133s p=0.549 n=20
Check Time 5.707s (± 0.31%) 6.524s (± 0.39%) 🔻+0.817s (+14.31%) 6.444s 6.639s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 6.048s (± 0.34%) 6.873s (± 0.39%) 🔻+0.824s (+13.63%) 6.788s 6.988s p=0.000 n=20
tanstack-router - native
Errors 1 1 ~ ~ ~ p=1.000 n=20
Symbols 571,756 566,932 -4,824 (- 0.84%) ~ ~ p=0.000 n=20
Types 397,689 389,013 -8,676 (- 2.18%) ~ ~ p=0.000 n=20
Memory Used 326,451k (± 0.02%) 345,177k (± 0.01%) 🔻+18,726k (+ 5.74%) 345,009k 345,370k p=0.000 n=20
Memory Allocs 4,339,406 (± 0.31%) 4,588,276 (± 0.18%) 🔻+248,870 (+ 5.74%) 4,568,698 4,635,360 p=0.000 n=20
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.041s (± 8.42%) 0.040s (± 3.48%) ~ 0.036s 0.045s p=0.701 n=20
Bind Time 0.014s (± 9.91%) 0.013s (± 9.95%) ~ 0.011s 0.022s p=0.082 n=20
Check Time 0.510s (± 0.86%) 0.589s (± 1.89%) 🔻+0.078s (+15.36%) 0.561s 0.653s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.584s (± 0.92%) 0.663s (± 1.60%) 🔻+0.079s (+13.50%) 0.641s 0.729s p=0.000 n=20
ts-pre-modules - native
Errors 87 87 ~ ~ ~ p=1.000 n=20
Symbols 231,616 231,748 +132 (+ 0.06%) ~ ~ p=0.000 n=20
Types 181,195 181,043 -152 (- 0.08%) ~ ~ p=0.000 n=20
Memory Used 192,980k (± 0.02%) 198,946k (± 0.02%) +5,966k (+ 3.09%) 198,835k 199,067k p=0.000 n=20
Memory Allocs 1,310,143 (± 0.02%) 1,396,864 (± 0.02%) 🔻+86,721 (+ 6.62%) 1,395,711 1,398,127 p=0.000 n=20
Config Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Parse Time 0.043s (± 3.09%) 0.044s (± 3.50%) ~ 0.039s 0.048s p=0.802 n=20
Bind Time 0.021s (± 5.45%) 0.022s (± 5.29%) ~ 0.017s 0.026s p=0.176 n=20
Check Time 0.303s (± 0.92%) 0.334s (± 0.81%) 🔻+0.030s (+10.05%) 0.323s 0.342s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.374s (± 0.63%) 0.406s (± 0.60%) 🔻+0.032s (+ 8.54%) 0.399s 0.418s p=0.000 n=20
vscode - native
Errors 11 11 ~ ~ ~ p=1.000 n=20
Symbols 7,641,801 7,439,634 -202,167 (- 2.65%) ~ ~ p=0.000 n=20
Types 4,491,813 4,258,043 🟩-233,770 (- 5.20%) ~ ~ p=0.000 n=20
Memory Used 5,279,484k (± 0.01%) 5,401,603k (± 0.02%) +122,119k (+ 2.31%) 5,398,681k 5,406,195k p=0.000 n=20
Memory Allocs 57,768,133 (± 0.03%) 63,118,121 (± 0.02%) 🔻+5,349,988 (+ 9.26%) 63,098,622 63,183,631 p=0.000 n=20
Config Time 0.035s (± 1.72%) 0.034s (± 1.53%) ~ 0.033s 0.036s p=0.254 n=20
Parse Time 0.905s (± 2.06%) 0.916s (± 2.17%) ~ 0.823s 1.006s p=0.490 n=20
Bind Time 0.328s (± 9.66%) 0.331s (±10.62%) ~ 0.281s 0.521s p=0.941 n=20
Check Time 7.721s (± 0.70%) 8.585s (± 0.86%) 🔻+0.863s (+11.18%) 8.241s 8.842s p=0.000 n=20
Emit Time 2.066s (± 8.60%) 2.235s (± 7.70%) 🔻+0.169s (+ 8.16%) 2.001s 2.988s p=0.000 n=20
Total Time 11.118s (± 1.57%) 12.161s (± 1.38%) 🔻+1.043s (+ 9.38%) 11.735s 12.990s p=0.000 n=20
webpack - native
Errors 607 612 +5 (+ 0.82%) ~ ~ p=0.000 n=20
Symbols 863,298 873,295 +9,997 (+ 1.16%) ~ ~ p=0.000 n=20
Types 602,667 604,622 +1,955 (+ 0.32%) ~ ~ p=0.000 n=20
Memory Used 638,805k (± 0.02%) 686,501k (± 0.01%) 🔻+47,696k (+ 7.47%) 686,043k 686,860k p=0.000 n=20
Memory Allocs 5,945,795 (± 0.12%) 7,103,705 (± 0.04%) 🔻+1,157,910 (+19.47%) 7,096,876 7,118,158 p=0.000 n=20
Config Time 0.004s 0.004s ~ ~ ~ p=1.000 n=20
Parse Time 0.118s (± 2.68%) 0.117s (± 2.29%) ~ 0.108s 0.126s p=0.596 n=20
Bind Time 0.040s (± 9.68%) 0.038s (± 7.61%) ~ 0.033s 0.056s p=0.762 n=20
Check Time 1.014s (± 0.86%) 1.197s (± 0.83%) 🔻+0.183s (+18.00%) 1.174s 1.242s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 1.200s (± 0.85%) 1.379s (± 0.79%) 🔻+0.180s (+14.96%) 1.346s 1.436s p=0.000 n=20
xstate-main - native
Errors 0 0 ~ ~ ~ p=1.000 n=20
Symbols 640,490 705,847 🔻+65,357 (+10.20%) ~ ~ p=0.000 n=20
Types 387,984 392,899 +4,915 (+ 1.27%) ~ ~ p=0.000 n=20
Memory Used 350,107k (± 0.02%) 400,400k (± 0.02%) 🔻+50,293k (+14.36%) 400,035k 400,825k p=0.000 n=20
Memory Allocs 3,969,278 (± 0.07%) 6,716,032 (± 0.08%) 🔻+2,746,754 (+69.20%) 6,703,574 6,748,950 p=0.000 n=20
Config Time 0.001s 0.001s ~ ~ ~ p=1.000 n=20
Parse Time 0.060s (± 3.65%) 0.061s (± 3.04%) ~ 0.052s 0.066s p=0.227 n=20
Bind Time 0.021s (±11.76%) 0.020s (± 9.27%) ~ 0.016s 0.028s p=0.311 n=20
Check Time 0.386s (± 0.83%) 0.569s (± 0.71%) 🔻+0.184s (+47.60%) 0.554s 0.581s p=0.000 n=20
Emit Time 0.000s 0.000s ~ ~ ~ p=1.000 n=20
Total Time 0.472s (± 0.91%) 0.656s (± 0.77%) 🔻+0.184s (+39.05%) 0.638s 0.677s p=0.000 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

Every statement of a run of unreachable statements reports the whole
run, so each one found the run by scanning its neighbors. Checking a
run of n statements thus took quadratic time: 20000 unreachable
statements took 2.85s to check, against 0.22s when the runs of a block
are found together and cached.

(seen in review)
A result cached while a cycle is in progress may be computed from an
incomplete result of the cycle, so it must be discarded when the cycle
ends. The exports of a module, the module of the implicit JSX import,
and the type of an instantiation expression were kept in plain fields
whose writes were not logged for discard, so they kept whatever the
first order of computing them produced.

Entries interned by pointer own cached results like links do, but the
check that cached state is memoized did not look at them, which is how
the instantiation expression slipped through. It now does. The loop
fixed point it then finds is kept on purpose: analyzing the loop again
after a cycle starts from another reference and can reach another
fixed point, which made controlFlowIterationErrors depend on order.

(seen in review)
The reachability of the last flow node asked about is kept outside any
memo, to make walking back through a run of statements linear. A
result kept while a cycle is in progress may come from an incomplete
result that the cycle later discards, and reusing it while effects are
being recorded leaves the reuse out of them. It is now kept only when
nothing can discard it, and reused only when reading need not be
accounted for.

(seen in review)
@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:

Something interesting changed - please have a look.

Details

every-app/open-seo

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

tsconfig.json

A result cached before its computation had effects is attached to them
later as if it had been attached when cached, so the link is not
logged for discard. Only an ordinary cycle was set aside for that, so
a variance measurement re-entered since then still logged it, and
ending the measurement dropped a dependency of a result that it never
discards, losing effects that reusing the result should replay.

(seen in review)
The documentation of beginMemo sat above readsWithoutMemo, reading as
part of it. Type.generation was described as an allocation counter,
but it is derived from the types a type is built from, all fixed when
it is created, which is why it is order-independent.

(seen in review)
getIntrinsicTagSymbol records whether an intrinsic tag resolved by name
or by index signature in jsxFlags, but wrote the bits directly. When the
tag's resolved symbol was discarded at the end of a cycle, the flags
stayed set, so a later resolution could see bits from a discarded
attempt. Write them as a flag memo of the resolved symbol so both are
discarded together.

(seen in review)
Editors ask the checker for contextual types and resolved signatures as
well as types and symbols, and both reach parts of the checker that
types and symbols alone do not, such as contextual typing of arguments
whose call has not been resolved. The check order fuzzer and the
typesfirst order now ask for them too, so that results which depend on
those queries being answered first are found.

(seen in review)
When the type of an expression inside the argument is asked for first,
the inferred tuple becomes readonly, though the binding pattern the
call result is destructured into makes it mutable when checked in
program order.

(seen in check order fuzzing)
Contextually checking a function sets a flag first, then infers the
return type. If a cycle is detected in between (for example a call
inside the body re-entering the outer resolution), the flag is not
logged but the return type is, so discarding the cycle drops the
return type and keeps the flag. A later request then infers the
return type without the contextual types, and a const assertion in
the body becomes readonly when queried before its binding pattern.

Clearing the flag on discard is not an option: it is TypeScript's
guard against re-checking the function from within its own check.
Instead, store the return type unlogged whenever the flag was, so
both are kept or neither.

(seen in check order fuzzing)
Unique symbol properties are named with the ID of their symbol, which
depends on the order symbols were created in, so the same type printed
differently after querying in another order.

(seen in check order fuzzing)
While the type implied by a binding pattern is computed as the
contextual type of its initializer, references to the pattern's
elements from the elements' defaults are any. The calls and types
computed from them were cached anyway, so asking for the contextual
type of the initializer first left `extra` in

    const { kind, payload, extra = kind === "a" ? ... : ... } = u;

as any rather than unknown. TypeScript behaves the same way.

Track the patterns as resolutions in progress rather than a separate
stack, so that a reference returning any marks the computation
circular and what was cached from it is discarded.

(seen in check order fuzzing)
A computation started at no node, such as one a query outside of
checking starts, reports errors at the current node wherever its result
is reused. When a computation started at another node reused it, its
effects joined that computation's without the node, so replaying them
located the errors wherever that computation was later reused instead.
Asking for the symbol of t.x and then the type of tx moved an excessive
depth error from t.x to tx.

Wrap such effects with the node they were observed at, when that is not
where the enclosing computation started.

(seen in check order fuzzing)
Editors ask for the types of names in type annotations too, which can
compute results at different nodes than checking does. Both the
typesfirst check order and check order fuzzing now ask for them.

(seen in check order fuzzing)
Builds and editors emit files before checking them, and declaration
emit asks the checker for results at nodes of its own. Fuzzing now
emits single files among its queries and compares the emitted output
too.

(seen in check order fuzzing)

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

None yet

Development

Successfully merging this pull request may close these issues.

1 participant