Skip to content

Conversation

@weswigham
Copy link
Member

@weswighamweswigham commented Dec 4, 2020

Fixes#41617
Fixes#43485
Fixes#44404

@typescript-bottypescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Dec 4, 2020
type Conv<T, U = T> =
{0: [T]; 1: Prepend<T, Conv<ExactExtract<U, T>>>}[U extends T ? 0 : 1];
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2321: Excessive stack depth comparing types 'Conv<ExactExtract<U, T>, ExactExtract<U, T>>' and 'unknown[]'.
Copy link
MemberAuthor

@weswighamweswighamDec 4, 2020

Choose a reason for hiding this comment

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

This part of this test was originally added because it had bad perf, and the test had a stack out error once the perf was fixed (circa #32079), however the error disappeared in #40971 and we just kidna didn't care (the test is for perf, after all). Turns out, the error should still be here, since the relationship does still infinitely expand (on only one side - we were erroneously flagging both sides are infinitely expanding - unknown[] definitely doesn't infinitely expand!).

@weswigham
Copy link
MemberAuthor

@ahejlsberg if you could take a look at this when you get a chance, that'd be great, thanks!

@andrewbranch
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 2, 2021

Heya @andrewbranch, I've started to run the tarball bundle task on this PR at b81c98b. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Apr 2, 2021

Hey @andrewbranch, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{"devDependencies":{"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/99984/artifacts?artifactName=tgz&fileId=BA6155E5AC16E3841FC2590B94FF87B9E10A9C49C2E9014AAB9A952942AB22E702&fileName=/typescript-4.3.0-insiders.20210402.tgz" } } 

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@amcasey
Copy link
Member

@weswigham What's happening with this?

@weswigham
Copy link
MemberAuthor

There's another issue this fixes -

functionf1<T,K1extendskeyofT,K2extendskeyofT[K1]>(x: T[K1][K2],y: Extract<T[K1][K2],string>){x=y;y=x;// missing error}// for comparison, the equivalent comparison with bare, unconstrained type parametersfunctionf2<T>(x: T,y: Extract<T,string>){x=y;y=x;// correctly has error}

decomposing T[K1][K2] to its base constraint takes > 5 steps, so without this change, hits our limiter and throws up a Maybe, which makes the comparison succeed.

@ahejlsberg it'd be super nice if you could review this ❤️

@ahejlsberg
Copy link
Member

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 19, 2021

Heya @ahejlsberg, I've started to run the perf test suite on this PR at b81c98b. You can monitor the build here.

Update: The results are in!

@typescript-bot
Copy link
Collaborator

@ahejlsberg
The results of the perf run you requested are in!

Here they are:

Comparison Report - master..41821

Metricmaster41821DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used345,228k (± 0.01%)345,203k (± 0.02%)-25k (- 0.01%)345,069k345,435k
Parse Time1.92s (± 0.59%)1.93s (± 0.67%)+0.01s (+ 0.62%)1.90s1.96s
Bind Time0.84s (± 0.74%)0.85s (± 0.35%)+0.01s (+ 1.07%)0.84s0.85s
Check Time5.28s (± 0.30%)5.32s (± 0.34%)+0.04s (+ 0.76%)5.28s5.35s
Emit Time5.54s (± 0.49%)5.66s (± 1.02%)+0.12s (+ 2.15%)5.56s5.84s
Total Time13.58s (± 0.22%)13.76s (± 0.45%)+0.18s (+ 1.32%)13.63s13.92s
Compiler-Unions - node (v10.16.3, x64)
Memory used200,338k (± 0.06%)200,312k (± 0.06%)-26k (- 0.01%)199,920k200,541k
Parse Time0.78s (± 0.67%)0.78s (± 0.57%)+0.00s (+ 0.39%)0.77s0.79s
Bind Time0.53s (± 0.76%)0.53s (± 0.98%)+0.00s (+ 0.38%)0.52s0.54s
Check Time7.54s (± 0.45%)7.57s (± 0.66%)+0.03s (+ 0.36%)7.43s7.65s
Emit Time2.25s (± 1.16%)2.47s (± 0.71%)+0.22s (+ 9.92%)2.43s2.51s
Total Time11.10s (± 0.56%)11.35s (± 0.40%)+0.25s (+ 2.29%)11.22s11.43s
Monaco - node (v10.16.3, x64)
Memory used341,735k (± 0.01%)341,648k (± 0.01%)-87k (- 0.03%)341,534k341,727k
Parse Time1.55s (± 0.65%)1.56s (± 1.17%)+0.01s (+ 0.39%)1.50s1.59s
Bind Time0.74s (± 0.49%)0.74s (± 0.80%)-0.00s (- 0.00%)0.73s0.76s
Check Time5.40s (± 0.42%)5.40s (± 0.41%)+0.00s (+ 0.00%)5.37s5.47s
Emit Time3.00s (± 1.15%)2.97s (± 0.89%)-0.03s (- 0.93%)2.92s3.05s
Total Time10.69s (± 0.47%)10.67s (± 0.49%)-0.02s (- 0.18%)10.61s10.84s
TFS - node (v10.16.3, x64)
Memory used304,221k (± 0.03%)304,253k (± 0.02%)+31k (+ 0.01%)304,121k304,399k
Parse Time1.21s (± 0.39%)1.22s (± 0.56%)+0.00s (+ 0.25%)1.20s1.23s
Bind Time0.70s (± 0.85%)0.71s (± 0.82%)+0.00s (+ 0.28%)0.69s0.72s
Check Time4.87s (± 0.35%)4.89s (± 0.59%)+0.01s (+ 0.27%)4.81s4.93s
Emit Time3.09s (± 0.99%)3.12s (± 1.15%)+0.04s (+ 1.20%)3.07s3.22s
Total Time9.88s (± 0.40%)9.93s (± 0.52%)+0.06s (+ 0.56%)9.84s10.08s
material-ui - node (v10.16.3, x64)
Memory used474,033k (± 0.02%)473,972k (± 0.02%)-61k (- 0.01%)473,802k474,154k
Parse Time1.94s (± 0.57%)1.95s (± 0.85%)+0.00s (+ 0.21%)1.92s1.98s
Bind Time0.66s (± 1.45%)0.66s (± 0.98%)+0.00s (+ 0.30%)0.64s0.67s
Check Time14.30s (± 0.71%)14.25s (± 0.78%)-0.05s (- 0.35%)14.09s14.48s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time16.90s (± 0.62%)16.85s (± 0.70%)-0.05s (- 0.27%)16.69s17.10s
Angular - node (v12.1.0, x64)
Memory used322,701k (± 0.02%)322,743k (± 0.02%)+42k (+ 0.01%)322,619k322,906k
Parse Time1.91s (± 0.41%)1.91s (± 0.53%)+0.00s (+ 0.10%)1.89s1.93s
Bind Time0.82s (± 0.63%)0.83s (± 0.54%)+0.01s (+ 1.59%)0.82s0.84s
Check Time5.16s (± 0.54%)5.20s (± 0.65%)+0.05s (+ 0.89%)5.13s5.31s
Emit Time5.76s (± 0.48%)5.80s (± 0.86%)+0.04s (+ 0.64%)5.72s5.94s
Total Time13.65s (± 0.37%)13.75s (± 0.61%)+0.10s (+ 0.73%)13.60s14.02s
Compiler-Unions - node (v12.1.0, x64)
Memory used187,815k (± 0.02%)187,490k (± 0.16%)-325k (- 0.17%)186,876k188,074k
Parse Time0.77s (± 0.78%)0.77s (± 0.75%)+0.01s (+ 0.91%)0.76s0.79s
Bind Time0.53s (± 0.69%)0.54s (± 0.93%)+0.01s (+ 1.71%)0.52s0.54s
Check Time7.00s (± 0.38%)7.06s (± 0.55%)+0.06s (+ 0.86%)6.99s7.15s
Emit Time2.25s (± 1.46%)2.43s (± 1.27%)+0.18s (+ 7.86%)2.37s2.52s
Total Time10.55s (± 0.45%)10.80s (± 0.49%)+0.25s (+ 2.38%)10.71s10.92s
Monaco - node (v12.1.0, x64)
Memory used323,851k (± 0.08%)324,099k (± 0.01%)+248k (+ 0.08%)324,000k324,170k
Parse Time1.54s (± 0.65%)1.54s (± 0.84%)+0.01s (+ 0.39%)1.52s1.57s
Bind Time0.72s (± 0.72%)0.72s (± 0.62%)-0.00s (- 0.14%)0.71s0.73s
Check Time5.24s (± 0.78%)5.24s (± 0.59%)+0.00s (+ 0.04%)5.19s5.33s
Emit Time3.05s (± 1.02%)3.06s (± 0.71%)+0.01s (+ 0.20%)3.02s3.13s
Total Time10.54s (± 0.67%)10.56s (± 0.47%)+0.02s (+ 0.15%)10.49s10.68s
TFS - node (v12.1.0, x64)
Memory used288,741k (± 0.02%)288,779k (± 0.02%)+38k (+ 0.01%)288,603k288,919k
Parse Time1.21s (± 0.84%)1.22s (± 0.60%)+0.01s (+ 0.91%)1.21s1.24s
Bind Time0.70s (± 0.71%)0.70s (± 0.98%)0.00s ( 0.00%)0.68s0.71s
Check Time4.78s (± 0.50%)4.80s (± 0.49%)+0.02s (+ 0.46%)4.76s4.87s
Emit Time3.13s (± 0.65%)3.12s (± 0.60%)-0.00s (- 0.00%)3.09s3.17s
Total Time9.81s (± 0.47%)9.84s (± 0.24%)+0.03s (+ 0.33%)9.79s9.90s
material-ui - node (v12.1.0, x64)
Memory used451,611k (± 0.10%)451,925k (± 0.02%)+314k (+ 0.07%)451,658k452,162k
Parse Time1.95s (± 0.45%)1.95s (± 0.50%)-0.00s (- 0.05%)1.93s1.97s
Bind Time0.64s (± 0.73%)0.64s (± 0.96%)+0.00s (+ 0.16%)0.63s0.66s
Check Time12.89s (± 0.80%)12.80s (± 0.69%)-0.09s (- 0.70%)12.63s13.09s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.48s (± 0.71%)15.39s (± 0.56%)-0.09s (- 0.57%)15.23s15.68s
Angular - node (v14.15.1, x64)
Memory used321,427k (± 0.01%)321,303k (± 0.08%)-124k (- 0.04%)320,319k321,462k
Parse Time1.91s (± 0.55%)1.91s (± 0.79%)+0.00s (+ 0.10%)1.88s1.95s
Bind Time0.87s (± 0.60%)0.87s (± 0.56%)+0.00s (+ 0.58%)0.86s0.88s
Check Time5.16s (± 0.46%)5.20s (± 0.48%)+0.04s (+ 0.79%)5.16s5.25s
Emit Time5.82s (± 0.51%)5.87s (± 0.78%)+0.05s (+ 0.91%)5.79s5.97s
Total Time13.76s (± 0.36%)13.85s (± 0.41%)+0.10s (+ 0.72%)13.71s13.97s
Compiler-Unions - node (v14.15.1, x64)
Memory used188,108k (± 0.63%)188,115k (± 0.64%)+7k (+ 0.00%)186,447k189,765k
Parse Time0.80s (± 0.72%)0.80s (± 0.83%)-0.00s (- 0.00%)0.79s0.82s
Bind Time0.56s (± 0.85%)0.56s (± 1.03%)+0.01s (+ 1.08%)0.55s0.57s
Check Time7.14s (± 0.54%)7.16s (± 0.52%)+0.02s (+ 0.27%)7.10s7.23s
Emit Time2.24s (± 0.90%)2.44s (± 0.68%)+0.20s (+ 8.87%)2.40s2.49s
Total Time10.74s (± 0.36%)10.97s (± 0.41%)+0.22s (+ 2.08%)10.89s11.07s
Monaco - node (v14.15.1, x64)
Memory used323,139k (± 0.01%)323,134k (± 0.01%)-5k (- 0.00%)323,086k323,160k
Parse Time1.57s (± 0.82%)1.57s (± 0.60%)-0.01s (- 0.38%)1.55s1.59s
Bind Time0.75s (± 0.78%)0.75s (± 0.44%)+0.00s (+ 0.40%)0.74s0.76s
Check Time5.21s (± 0.71%)5.22s (± 0.46%)+0.01s (+ 0.13%)5.16s5.28s
Emit Time3.09s (± 1.01%)3.07s (± 0.71%)-0.02s (- 0.65%)3.01s3.12s
Total Time10.62s (± 0.43%)10.60s (± 0.33%)-0.02s (- 0.17%)10.54s10.68s
TFS - node (v14.15.1, x64)
Memory used287,683k (± 0.01%)287,668k (± 0.01%)-14k (- 0.00%)287,634k287,712k
Parse Time1.27s (± 1.58%)1.28s (± 0.83%)+0.00s (+ 0.31%)1.25s1.30s
Bind Time0.71s (± 0.83%)0.73s (± 1.60%)+0.01s (+ 1.68%)0.71s0.77s
Check Time4.82s (± 0.33%)4.80s (± 0.46%)-0.01s (- 0.29%)4.75s4.84s
Emit Time3.21s (± 0.85%)3.21s (± 0.72%)0.00s ( 0.00%)3.17s3.28s
Total Time10.01s (± 0.37%)10.02s (± 0.35%)+0.00s (+ 0.03%)9.96s10.10s
material-ui - node (v14.15.1, x64)
Memory used450,052k (± 0.07%)450,117k (± 0.01%)+65k (+ 0.01%)450,060k450,178k
Parse Time1.98s (± 0.61%)2.00s (± 0.55%)+0.02s (+ 1.16%)1.98s2.03s
Bind Time0.70s (± 0.82%)0.70s (± 0.84%)+0.00s (+ 0.57%)0.69s0.72s
Check Time12.99s (± 0.64%)12.99s (± 0.46%)-0.00s (- 0.04%)12.90s13.10s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.67s (± 0.56%)15.69s (± 0.40%)+0.02s (+ 0.11%)15.60s15.82s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-206-generic
Architecturex64
Available Memory16 GB
Available Memory2 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
BenchmarkNameIterations
Current4182110
Baselinemaster10

Developer Information:

Download Benchmark

@ahejlsberg
Copy link
Member

What if one of the sides has a constraint that keeps on generating deeper and deeper types? Won't we just keep on going and eventually hit the 100 level panic limiter and issue an error? Is that what we want?

@weswigham
Copy link
MemberAuthor

I think it is - a generative type should probably hit the issues-an-error limiter and not the quietly-pass-assignability limiter.

@ahejlsberg
Copy link
Member

Hmm. But it just seems really odd that we would issue an error if nothing changes one one side, but if that side instead flip-flops between two types, then all of a sudden we're fine with it (because we produce a Ternary.Maybe).

@ahejlsberg
Copy link
Member

In other words, our limiter is based on the notion that we count occurrences of cycles, and all of a sudden we're saying that a cycle of length one doesn't count at all. I'm not sure I can make that make sense.

@weswigham
Copy link
MemberAuthor

weswigham commented May 19, 2021

Hmm. But it just seems really odd that we would issue an error if nothing changes one one side, but if that side instead flip-flops between two types, then all of a sudden we're fine with it (because we produce a Ternary.Maybe).

In such a case, we never get to check the one side that "didn't change" precisely because the other side decomposed forever. That's exactly why it makes sense to issue an error - we never even got to look at the rhs because the lhs was expanding forever. If both the lhs and rhs expand forever, we'll still issue an error, because the lhs expanding forever will prevent us from even checking that the rhs expands forever. "This type expands forever" is a very distinct problem from "this type depends on a comparison which occurred in its history already" - the first we don't really have a reasonable operation to do (blindly allowing the assignment to anything isn't good - we're not even looking at the target!), while for the second, a Ternary.Maybe result (as a non-caching True, since we can assume a comparison in progress is a success while looking to disprove that) allows the comparison to continue on the other parts of the type structure.

if that side instead flip-flops between two types, then all of a sudden we're fine with it (because we produce a Ternary.Maybe).

Specifically, I think this is at least more justifiable, since then we've actually explored some structure on both sides, we just want to refrain from exploring too deeply. Whereas when we only ever explore how one side of the relationship expands, it's very hard to justify the assignment (why should a T[A][B] function as a never on the source side and be assignable to anything just because it's deeply generic? Meanwhile if we compare T[A][B] to U[C][D] we're more within our rights, imo, to just give up and say "it's too deeply generic on both sides and we don't wanna exhaustively explore this - just let it pass (unless a less nested check we have available fails)").

In other words, our limiter is based on the notion that we count occurrences of cycles, and all of a sudden we're saying that a cycle of length one doesn't count at all. I'm not sure I can make that make sense.

Except it's not actually counting cycles because it has no knowledge of which side of the comparison (if any) was actually recurred on to produce the new pair of types, which is what it'd need to count that (specifically, it'd only check if the side we recurred on is deeply nested). What we're tracking right now is just occurrences in history, which doesn't correctly admit, say, the LHS looping forever while the RHS just sits there uninspected because we have yet to recur on it (which is turns out is very common, as pretty simple LHS constructs end up taking more than 5 steps to expand to a final constraint!)

Ideally, we'd only append to the sourceStack/targetStack when that side of the relationship is recurred on, but that would require threading more information through every recursive call of isRelatedTo. Maybe the intersectionState parameter could be hijacked to traffic this, but it probably wouldn't be pretty. Only appending an element when it changes is a decent approximation since we generally try very hard to not recur on a type and immediately produce the same comparison - generally speaking, we like to have every decomposition we perform change the type we decompose in some way, or we don't attempt the decomposition at all (specifically, we don't let a generic be directly constrained to itself - that's an error - it has to go through some cycle of deferred decompositions instead, which, under this scheme, will always result in new entries into the stack, and thus for a cycle to be detected).

@ahejlsberg
Copy link
Member

Let's run the tests to get some more real world data on what the effect is.

@ahejlsberg
Copy link
Member

@typescript-bot run dt
@typescript-bot test this
@typescript-bot user test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 19, 2021

Heya @ahejlsberg, I've started to run the extended test suite on this PR at b81c98b. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 19, 2021

Heya @ahejlsberg, I've started to run the parallelized community code test suite on this PR at b81c98b. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented May 19, 2021

Heya @ahejlsberg, I've started to run the parallelized Definitely Typed test suite on this PR at b81c98b. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

@weswigham
The results of the perf run you requested are in!

Here they are:

Comparison Report - main..41821

Metricmain41821DeltaBestWorst
Angular - node (v10.16.3, x64)
Memory used351,004k (± 0.02%)351,060k (± 0.02%)+56k (+ 0.02%)350,878k351,287k
Parse Time1.90s (± 0.52%)1.91s (± 0.36%)+0.01s (+ 0.42%)1.90s1.93s
Bind Time0.86s (± 0.75%)0.87s (± 0.69%)+0.00s (+ 0.46%)0.85s0.88s
Check Time5.37s (± 0.60%)5.38s (± 0.58%)+0.02s (+ 0.30%)5.33s5.47s
Emit Time5.82s (± 0.66%)5.85s (± 0.82%)+0.03s (+ 0.57%)5.75s5.95s
Total Time13.95s (± 0.37%)14.00s (± 0.37%)+0.05s (+ 0.39%)13.88s14.14s
Compiler-Unions - node (v10.16.3, x64)
Memory used203,395k (± 0.03%)203,447k (± 0.03%)+52k (+ 0.03%)203,308k203,619k
Parse Time0.78s (± 0.63%)0.79s (± 0.87%)+0.00s (+ 0.26%)0.77s0.80s
Bind Time0.53s (± 1.27%)0.53s (± 0.90%)+0.00s (+ 0.00%)0.52s0.54s
Check Time7.83s (± 0.84%)7.83s (± 0.69%)-0.00s (- 0.01%)7.75s8.02s
Emit Time2.44s (± 1.09%)2.43s (± 0.87%)-0.01s (- 0.41%)2.40s2.48s
Total Time11.58s (± 0.72%)11.57s (± 0.63%)-0.01s (- 0.06%)11.47s11.83s
Monaco - node (v10.16.3, x64)
Memory used340,578k (± 0.02%)340,660k (± 0.03%)+83k (+ 0.02%)340,516k340,992k
Parse Time1.46s (± 0.55%)1.46s (± 0.48%)-0.00s (- 0.21%)1.45s1.48s
Bind Time0.75s (± 0.82%)0.75s (± 0.46%)-0.00s (- 0.27%)0.74s0.75s
Check Time5.42s (± 0.54%)5.42s (± 0.69%)+0.00s (+ 0.00%)5.32s5.50s
Emit Time3.16s (± 0.70%)3.16s (± 0.99%)-0.00s (- 0.09%)3.11s3.23s
Total Time10.79s (± 0.39%)10.78s (± 0.52%)-0.01s (- 0.07%)10.70s10.91s
TFS - node (v10.16.3, x64)
Memory used304,033k (± 0.02%)304,057k (± 0.02%)+23k (+ 0.01%)303,932k304,169k
Parse Time1.19s (± 0.50%)1.19s (± 0.74%)+0.00s (+ 0.08%)1.17s1.21s
Bind Time0.71s (± 0.78%)0.71s (± 0.69%)+0.00s (+ 0.28%)0.70s0.72s
Check Time4.91s (± 0.42%)4.92s (± 0.78%)+0.01s (+ 0.24%)4.86s5.02s
Emit Time3.34s (± 1.15%)3.34s (± 1.11%)-0.01s (- 0.21%)3.27s3.45s
Total Time10.15s (± 0.44%)10.16s (± 0.72%)+0.01s (+ 0.10%)10.03s10.34s
material-ui - node (v10.16.3, x64)
Memory used469,707k (± 0.01%)469,737k (± 0.01%)+30k (+ 0.01%)469,679k469,877k
Parse Time1.73s (± 0.39%)1.73s (± 0.80%)-0.00s (- 0.29%)1.69s1.77s
Bind Time0.66s (± 0.74%)0.67s (± 1.52%)+0.00s (+ 0.15%)0.63s0.68s
Check Time14.22s (± 0.58%)14.14s (± 0.55%)-0.09s (- 0.60%)13.99s14.35s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time16.63s (± 0.51%)16.53s (± 0.46%)-0.09s (- 0.56%)16.39s16.74s
Angular - node (v12.1.0, x64)
Memory used328,871k (± 0.08%)329,010k (± 0.03%)+139k (+ 0.04%)328,872k329,210k
Parse Time1.87s (± 0.43%)1.87s (± 0.36%)+0.00s (+ 0.11%)1.86s1.88s
Bind Time0.85s (± 0.96%)0.84s (± 0.66%)-0.00s (- 0.59%)0.83s0.85s
Check Time5.22s (± 0.66%)5.21s (± 0.38%)-0.01s (- 0.23%)5.17s5.26s
Emit Time6.07s (± 0.72%)6.09s (± 0.72%)+0.02s (+ 0.31%)6.02s6.19s
Total Time14.00s (± 0.51%)14.01s (± 0.40%)+0.01s (+ 0.04%)13.92s14.12s
Compiler-Unions - node (v12.1.0, x64)
Memory used190,766k (± 0.13%)190,849k (± 0.10%)+83k (+ 0.04%)190,367k191,081k
Parse Time0.78s (± 0.79%)0.78s (± 0.79%)+0.00s (+ 0.00%)0.77s0.79s
Bind Time0.53s (± 0.75%)0.53s (± 0.84%)+0.00s (+ 0.19%)0.52s0.54s
Check Time7.35s (± 1.26%)7.28s (± 0.64%)-0.07s (- 1.02%)7.21s7.43s
Emit Time2.42s (± 0.37%)2.43s (± 0.75%)+0.01s (+ 0.37%)2.41s2.48s
Total Time11.09s (± 0.86%)11.02s (± 0.50%)-0.06s (- 0.56%)10.95s11.16s
Monaco - node (v12.1.0, x64)
Memory used323,760k (± 0.06%)323,760k (± 0.02%)+1k (+ 0.00%)323,627k323,977k
Parse Time1.42s (± 0.71%)1.43s (± 0.65%)+0.01s (+ 0.49%)1.41s1.45s
Bind Time0.72s (± 0.90%)0.73s (± 0.65%)+0.01s (+ 0.69%)0.72s0.74s
Check Time5.23s (± 0.58%)5.26s (± 0.54%)+0.03s (+ 0.59%)5.20s5.32s
Emit Time3.19s (± 0.78%)3.19s (± 0.89%)-0.01s (- 0.25%)3.14s3.26s
Total Time10.57s (± 0.41%)10.61s (± 0.47%)+0.04s (+ 0.34%)10.51s10.74s
TFS - node (v12.1.0, x64)
Memory used288,731k (± 0.02%)288,775k (± 0.03%)+43k (+ 0.02%)288,577k288,962k
Parse Time1.20s (± 0.72%)1.20s (± 0.58%)+0.00s (+ 0.25%)1.19s1.22s
Bind Time0.70s (± 0.74%)0.70s (± 1.27%)+0.01s (+ 0.86%)0.69s0.73s
Check Time4.82s (± 0.30%)4.84s (± 0.38%)+0.02s (+ 0.41%)4.79s4.89s
Emit Time3.34s (± 1.11%)3.38s (± 0.77%)+0.04s (+ 1.14%)3.30s3.42s
Total Time10.06s (± 0.44%)10.12s (± 0.41%)+0.07s (+ 0.68%)10.07s10.26s
material-ui - node (v12.1.0, x64)
Memory used448,522k (± 0.01%)448,300k (± 0.08%)-222k (- 0.05%)447,280k448,668k
Parse Time1.72s (± 0.62%)1.72s (± 0.93%)+0.00s (+ 0.06%)1.69s1.76s
Bind Time0.65s (± 1.02%)0.65s (± 0.80%)+0.00s (+ 0.15%)0.64s0.66s
Check Time12.76s (± 0.72%)12.78s (± 0.82%)+0.02s (+ 0.16%)12.57s13.02s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.13s (± 0.59%)15.15s (± 0.67%)+0.02s (+ 0.15%)14.96s15.37s
Angular - node (v14.15.1, x64)
Memory used327,621k (± 0.00%)327,619k (± 0.01%)-1k (- 0.00%)327,558k327,683k
Parse Time1.90s (± 0.62%)1.90s (± 0.57%)0.00s ( 0.00%)1.88s1.93s
Bind Time0.89s (± 0.50%)0.89s (± 0.56%)-0.00s (- 0.34%)0.88s0.90s
Check Time5.26s (± 0.71%)5.25s (± 0.51%)-0.01s (- 0.29%)5.19s5.30s
Emit Time6.15s (± 0.48%)6.14s (± 0.88%)-0.01s (- 0.23%)6.03s6.25s
Total Time14.21s (± 0.35%)14.18s (± 0.52%)-0.03s (- 0.21%)14.01s14.31s
Compiler-Unions - node (v14.15.1, x64)
Memory used191,477k (± 0.60%)191,482k (± 0.59%)+5k (+ 0.00%)189,612k192,806k
Parse Time0.81s (± 0.82%)0.80s (± 0.61%)-0.01s (- 0.74%)0.80s0.82s
Bind Time0.56s (± 0.00%)0.56s (± 0.72%)-0.00s (- 0.18%)0.55s0.57s
Check Time7.50s (± 0.56%)7.52s (± 0.69%)+0.02s (+ 0.24%)7.38s7.63s
Emit Time2.42s (± 0.55%)2.42s (± 0.56%)+0.00s (+ 0.17%)2.39s2.45s
Total Time11.29s (± 0.39%)11.31s (± 0.51%)+0.01s (+ 0.12%)11.16s11.44s
Monaco - node (v14.15.1, x64)
Memory used322,567k (± 0.00%)322,563k (± 0.00%)-4k (- 0.00%)322,535k322,608k
Parse Time1.48s (± 0.51%)1.49s (± 0.68%)+0.00s (+ 0.13%)1.47s1.52s
Bind Time0.75s (± 0.45%)0.75s (± 0.65%)+0.00s (+ 0.13%)0.75s0.77s
Check Time5.21s (± 0.35%)5.24s (± 0.60%)+0.03s (+ 0.56%)5.16s5.30s
Emit Time3.23s (± 0.54%)3.22s (± 0.91%)-0.01s (- 0.31%)3.17s3.29s
Total Time10.68s (± 0.28%)10.70s (± 0.48%)+0.02s (+ 0.19%)10.59s10.81s
TFS - node (v14.15.1, x64)
Memory used287,720k (± 0.00%)287,715k (± 0.01%)-5k (- 0.00%)287,687k287,756k
Parse Time1.25s (± 1.57%)1.23s (± 1.23%)-0.02s (- 1.28%)1.20s1.26s
Bind Time0.73s (± 3.16%)0.77s (± 5.28%)+0.04s (+ 5.88%)0.71s0.88s
Check Time4.85s (± 0.63%)4.87s (± 0.60%)+0.02s (+ 0.43%)4.81s4.93s
Emit Time3.46s (± 0.70%)3.45s (± 0.88%)-0.00s (- 0.06%)3.41s3.56s
Total Time10.29s (± 0.50%)10.33s (± 0.55%)+0.04s (+ 0.43%)10.18s10.43s
material-ui - node (v14.15.1, x64)
Memory used446,740k (± 0.06%)446,884k (± 0.01%)+145k (+ 0.03%)446,813k446,926k
Parse Time1.76s (± 0.61%)1.76s (± 0.54%)-0.00s (- 0.17%)1.74s1.77s
Bind Time0.69s (± 0.75%)0.69s (± 0.72%)-0.00s (- 0.44%)0.68s0.70s
Check Time13.10s (± 1.28%)12.86s (± 1.05%)-0.24s (- 1.82%)12.72s13.38s
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)0.00s ( NaN%)0.00s0.00s
Total Time15.55s (± 1.09%)15.31s (± 0.89%)-0.25s (- 1.58%)15.15s15.83s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-206-generic
Architecturex64
Available Memory16 GB
Available Memory1 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v14.15.1, x64)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v14.15.1, x64)
  • Compiler-Unions - node (v10.16.3, x64)
  • Compiler-Unions - node (v12.1.0, x64)
  • Compiler-Unions - node (v14.15.1, x64)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v14.15.1, x64)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v14.15.1, x64)
  • material-ui - node (v10.16.3, x64)
  • material-ui - node (v12.1.0, x64)
  • material-ui - node (v14.15.1, x64)
BenchmarkNameIterations
Current4182110
Baselinemain10

Developer Information:

Download Benchmark

@weswigham
Copy link
MemberAuthor

@typescript-bot pack this for posterity

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 20, 2021

Heya @weswigham, I've started to run the tarball bundle task on this PR at f76d880. You can monitor the build here.

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 20, 2021

Hey @weswigham, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{"devDependencies":{"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/109006/artifacts?artifactName=tgz&fileId=32F14BC1CCCC5B6DD6C83299C9148D3BA148907CCB93F5D7064C29EF2F37E2A902&fileName=/typescript-4.5.0-insiders.20210820.tgz" } } 

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

@weswigham
Copy link
MemberAuthor

All extended test suites (RWC, user, DT) look good. Let me try to remove the extra isDeeplyNestedType calls and give em another go - if they stay green we'll go with that, otherwise I'll revert that and go with this~

@weswigham
Copy link
MemberAuthor

Nope, scratch that - local tests fail if we remove them - the depth check guards are needed on the comparison of conditional constraints, otherwise we issue stack depth warnings when comparing conditional types that operate over recursive type aliases (rather than only erroring when their actual execution exceeds the instantiation limit). We need 'em so we stop recurring further into the (infinitely expanding) type, and instead gracefully try a different constraint form (eg, the distributive constraint instead of the non-distributive one, or vice-versa).

So this should be good to go as-is. @ahejlsberg anything else to add?

@fabb
Copy link

fabb commented Aug 23, 2021

Hey @weswigham, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{"devDependencies":{"typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/109006/artifacts?artifactName=tgz&fileId=32F14BC1CCCC5B6DD6C83299C9148D3BA148907CCB93F5D7064C29EF2F37E2A902&fileName=/typescript-4.5.0-insiders.20210820.tgz" } } 

and then running npm install.

There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

This version still does not fix the issue for my case: #44404 (comment)

targetKeys = nameType || constraintType;
}
if (isRelatedTo(source, targetKeys, reportErrors) === Ternary.True){
if (isRelatedTo(source, targetKeys, RecursionFlags.Target, reportErrors) === Ternary.True){
Copy link
Member

Choose a reason for hiding this comment

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

I added this one while resolving merge conflicts

@andrewbranch
Copy link
Member

Apparently I didn’t pull recently enough to resolve all the conflicts 🤦

@andrewbranchandrewbranch merged commit 612c92d into microsoft:mainSep 30, 2021
@sandersnsandersn mentioned this pull request Oct 5, 2021
@microsoftmicrosoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Milestone BugPRs that fix a bug with a specific milestone

Projects

Archived in project

6 participants

@weswigham@andrewbranch@typescript-bot@amcasey@ahejlsberg@fabb