Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use homomorphic templated type for Omit #42524

Closed
wants to merge 4 commits into from

Conversation

weswigham
Copy link
Member

@weswigham weswigham commented Jan 27, 2021

Omit as written today is non-homomorphic, so the original keys are unrecoverable when an index type subtype reduces with a key type. however, with #41976 in place, we can swap Omit over to use a template and be homomorphic, and fix two longstanding issues with one PR.

Fixes #36981
Fixes #34793
Fixes #31104

@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Jan 27, 2021
@DanielRosenwasser
Copy link
Member

Seems like #34793 was already fixed, but this loses the ability for us to reuse type aliases.

@@ -17925,7 +17925,7 @@ namespace ts {
}
}
}
else if (isGenericMappedType(target) && !target.declaration.nameType) {
else if (isGenericMappedType(target) && (!target.declaration.nameType || relation === comparableRelation)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this change and the bit below, you couldn't cast between an Omit of something and that something. That mapped types with nameType fields currently have no generic relations is a place we should probably improve upon anyway, however this is the minimal change required to get that comparable relation to work as expected.

@DanielRosenwasser
Copy link
Member

Seems like this should close #31104, as it addresses the suggestion I made in #31104 (comment)

@weswigham
Copy link
Member Author

weswigham commented Jan 27, 2021

Yeah, the issue ref is in the OP now.

@weswigham
Copy link
Member Author

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 27, 2021

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

Update: The results are in!

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 27, 2021

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 27, 2021

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

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 27, 2021

Heya @weswigham, I've started to run the parallelized Definitely Typed test suite on this PR at 743f49a. 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 - master..42524

Metric master 42524 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 346,450k (± 0.03%) 346,522k (± 0.02%) +72k (+ 0.02%) 346,326k 346,745k
Parse Time 1.99s (± 0.75%) 1.98s (± 0.55%) -0.00s (- 0.20%) 1.96s 2.01s
Bind Time 0.82s (± 0.60%) 0.82s (± 0.60%) -0.00s (- 0.12%) 0.81s 0.83s
Check Time 4.99s (± 0.50%) 5.00s (± 0.39%) +0.02s (+ 0.32%) 4.95s 5.04s
Emit Time 5.33s (± 0.59%) 5.32s (± 0.51%) -0.02s (- 0.32%) 5.25s 5.36s
Total Time 13.13s (± 0.36%) 13.13s (± 0.38%) -0.01s (- 0.05%) 13.03s 13.22s
Compiler-Unions - node (v10.16.3, x64)
Memory used 214,945k (± 0.05%) 214,960k (± 0.05%) +15k (+ 0.01%) 214,661k 215,148k
Parse Time 0.79s (± 0.71%) 0.80s (± 0.84%) +0.01s (+ 1.14%) 0.78s 0.81s
Bind Time 0.50s (± 0.99%) 0.49s (± 1.18%) -0.00s (- 0.60%) 0.48s 0.51s
Check Time 10.75s (± 0.66%) 10.62s (± 0.46%) -0.13s (- 1.18%) 10.55s 10.77s
Emit Time 2.33s (± 1.48%) 2.35s (± 1.93%) +0.02s (+ 0.73%) 2.28s 2.50s
Total Time 14.37s (± 0.64%) 14.26s (± 0.32%) -0.11s (- 0.73%) 14.17s 14.38s
Monaco - node (v10.16.3, x64)
Memory used 355,351k (± 0.01%) 355,356k (± 0.01%) +5k (+ 0.00%) 355,261k 355,475k
Parse Time 1.60s (± 0.44%) 1.60s (± 0.66%) +0.01s (+ 0.38%) 1.59s 1.63s
Bind Time 0.72s (± 0.72%) 0.72s (± 0.65%) -0.00s (- 0.14%) 0.71s 0.73s
Check Time 5.16s (± 0.38%) 5.18s (± 0.59%) +0.02s (+ 0.33%) 5.12s 5.26s
Emit Time 2.84s (± 1.10%) 2.82s (± 0.64%) -0.01s (- 0.53%) 2.79s 2.86s
Total Time 10.31s (± 0.36%) 10.32s (± 0.51%) +0.01s (+ 0.09%) 10.23s 10.43s
TFS - node (v10.16.3, x64)
Memory used 308,206k (± 0.02%) 308,170k (± 0.03%) -37k (- 0.01%) 308,037k 308,445k
Parse Time 1.23s (± 0.57%) 1.24s (± 0.70%) +0.01s (+ 0.57%) 1.22s 1.26s
Bind Time 0.68s (± 1.12%) 0.68s (± 1.09%) +0.00s (+ 0.59%) 0.66s 0.69s
Check Time 4.60s (± 0.33%) 4.58s (± 0.60%) -0.02s (- 0.46%) 4.51s 4.63s
Emit Time 2.93s (± 1.00%) 2.92s (± 1.10%) -0.01s (- 0.44%) 2.83s 2.98s
Total Time 9.44s (± 0.32%) 9.41s (± 0.33%) -0.03s (- 0.29%) 9.33s 9.46s
material-ui - node (v10.16.3, x64)
Memory used 496,325k (± 0.02%) 496,318k (± 0.02%) -7k (- 0.00%) 496,118k 496,479k
Parse Time 2.04s (± 0.43%) 2.06s (± 0.63%) +0.02s (+ 1.23%) 2.04s 2.10s
Bind Time 0.66s (± 0.91%) 0.66s (± 1.71%) +0.00s (+ 0.46%) 0.63s 0.68s
Check Time 14.00s (± 0.31%) 14.11s (± 0.87%) +0.11s (+ 0.78%) 13.82s 14.41s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 16.69s (± 0.26%) 16.83s (± 0.78%) +0.14s (+ 0.83%) 16.52s 17.17s
Angular - node (v12.1.0, x64)
Memory used 323,891k (± 0.11%) 324,065k (± 0.02%) +174k (+ 0.05%) 323,956k 324,158k
Parse Time 1.97s (± 0.41%) 1.99s (± 0.87%) +0.02s (+ 0.86%) 1.95s 2.04s
Bind Time 0.80s (± 1.06%) 0.80s (± 1.00%) +0.00s (+ 0.38%) 0.79s 0.83s
Check Time 4.90s (± 0.48%) 4.90s (± 0.55%) -0.00s (- 0.02%) 4.86s 4.98s
Emit Time 5.49s (± 0.79%) 5.50s (± 1.11%) +0.01s (+ 0.16%) 5.41s 5.72s
Total Time 13.16s (± 0.50%) 13.19s (± 0.65%) +0.03s (+ 0.20%) 13.05s 13.44s
Compiler-Unions - node (v12.1.0, x64)
Memory used 200,193k (± 0.06%) 200,272k (± 0.09%) +80k (+ 0.04%) 199,733k 200,599k
Parse Time 0.78s (± 0.88%) 0.78s (± 0.74%) +0.00s (+ 0.52%) 0.77s 0.79s
Bind Time 0.49s (± 1.00%) 0.50s (± 0.68%) +0.00s (+ 0.61%) 0.49s 0.50s
Check Time 9.88s (± 0.95%) 9.90s (± 1.10%) +0.02s (+ 0.16%) 9.71s 10.11s
Emit Time 2.37s (± 1.03%) 2.37s (± 1.67%) +0.00s (+ 0.21%) 2.26s 2.43s
Total Time 13.52s (± 0.70%) 13.55s (± 0.94%) +0.03s (+ 0.21%) 13.28s 13.83s
Monaco - node (v12.1.0, x64)
Memory used 337,563k (± 0.03%) 337,515k (± 0.02%) -49k (- 0.01%) 337,363k 337,620k
Parse Time 1.58s (± 0.42%) 1.59s (± 0.59%) +0.02s (+ 1.01%) 1.56s 1.61s
Bind Time 0.70s (± 0.74%) 0.70s (± 1.11%) -0.00s (- 0.29%) 0.68s 0.72s
Check Time 4.94s (± 0.38%) 4.95s (± 0.71%) +0.01s (+ 0.22%) 4.86s 5.01s
Emit Time 2.88s (± 0.64%) 2.89s (± 0.71%) +0.01s (+ 0.35%) 2.84s 2.93s
Total Time 10.10s (± 0.28%) 10.13s (± 0.51%) +0.04s (+ 0.36%) 9.99s 10.24s
TFS - node (v12.1.0, x64)
Memory used 292,418k (± 0.02%) 292,431k (± 0.02%) +13k (+ 0.00%) 292,321k 292,558k
Parse Time 1.26s (± 0.56%) 1.26s (± 0.69%) -0.00s (- 0.08%) 1.24s 1.28s
Bind Time 0.65s (± 0.51%) 0.66s (± 1.16%) +0.01s (+ 0.77%) 0.64s 0.68s
Check Time 4.52s (± 0.64%) 4.53s (± 0.57%) +0.01s (+ 0.24%) 4.47s 4.59s
Emit Time 2.96s (± 1.05%) 2.94s (± 0.74%) -0.03s (- 0.88%) 2.87s 2.97s
Total Time 9.39s (± 0.41%) 9.38s (± 0.44%) -0.01s (- 0.14%) 9.25s 9.46s
material-ui - node (v12.1.0, x64)
Memory used 473,536k (± 0.01%) 473,417k (± 0.05%) -119k (- 0.03%) 472,451k 473,684k
Parse Time 2.06s (± 0.70%) 2.08s (± 0.33%) +0.01s (+ 0.63%) 2.06s 2.09s
Bind Time 0.64s (± 1.05%) 0.64s (± 0.46%) +0.01s (+ 0.78%) 0.64s 0.65s
Check Time 12.61s (± 0.56%) 12.77s (± 0.51%) +0.16s (+ 1.27%) 12.59s 12.92s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.31s (± 0.50%) 15.49s (± 0.42%) +0.18s (+ 1.16%) 15.32s 15.64s
Angular - node (v14.15.1, x64)
Memory used 322,746k (± 0.01%) 322,704k (± 0.01%) -42k (- 0.01%) 322,656k 322,759k
Parse Time 1.99s (± 0.49%) 2.01s (± 0.80%) +0.01s (+ 0.70%) 1.97s 2.04s
Bind Time 0.85s (± 1.02%) 0.86s (± 0.68%) +0.01s (+ 0.59%) 0.85s 0.87s
Check Time 4.88s (± 0.30%) 4.91s (± 0.19%) +0.02s (+ 0.43%) 4.89s 4.93s
Emit Time 5.54s (± 0.53%) 5.56s (± 0.57%) +0.02s (+ 0.36%) 5.48s 5.62s
Total Time 13.27s (± 0.26%) 13.33s (± 0.33%) +0.06s (+ 0.47%) 13.25s 13.44s
Compiler-Unions - node (v14.15.1, x64)
Memory used 202,199k (± 0.57%) 202,794k (± 0.34%) +595k (+ 0.29%) 200,296k 203,467k
Parse Time 0.82s (± 0.86%) 0.82s (± 0.58%) -0.00s (- 0.24%) 0.81s 0.83s
Bind Time 0.53s (± 0.65%) 0.53s (± 0.71%) -0.00s (- 0.38%) 0.52s 0.53s
Check Time 9.81s (± 0.64%) 9.89s (± 0.82%) +0.08s (+ 0.77%) 9.71s 10.14s
Emit Time 2.36s (± 1.61%) 2.37s (± 2.06%) +0.01s (+ 0.51%) 2.29s 2.49s
Total Time 13.51s (± 0.28%) 13.60s (± 0.78%) +0.09s (+ 0.67%) 13.45s 13.99s
Monaco - node (v14.15.1, x64)
Memory used 336,863k (± 0.01%) 336,858k (± 0.01%) -5k (- 0.00%) 336,808k 336,907k
Parse Time 1.64s (± 0.61%) 1.65s (± 1.03%) +0.02s (+ 1.04%) 1.62s 1.70s
Bind Time 0.73s (± 1.00%) 0.74s (± 0.68%) +0.01s (+ 0.96%) 0.73s 0.75s
Check Time 4.86s (± 0.36%) 4.87s (± 0.62%) +0.02s (+ 0.35%) 4.80s 4.92s
Emit Time 2.93s (± 0.56%) 2.94s (± 0.45%) +0.01s (+ 0.34%) 2.92s 2.97s
Total Time 10.15s (± 0.31%) 10.20s (± 0.33%) +0.05s (+ 0.48%) 10.11s 10.26s
TFS - node (v14.15.1, x64)
Memory used 291,612k (± 0.00%) 291,617k (± 0.00%) +5k (+ 0.00%) 291,605k 291,643k
Parse Time 1.29s (± 1.06%) 1.29s (± 0.82%) 0.00s ( 0.00%) 1.28s 1.33s
Bind Time 0.69s (± 1.02%) 0.69s (± 0.75%) -0.00s (- 0.00%) 0.68s 0.70s
Check Time 4.51s (± 0.51%) 4.50s (± 0.50%) -0.01s (- 0.22%) 4.44s 4.53s
Emit Time 3.05s (± 0.66%) 3.06s (± 0.91%) +0.01s (+ 0.23%) 3.02s 3.16s
Total Time 9.54s (± 0.31%) 9.54s (± 0.43%) 0.00s ( 0.00%) 9.47s 9.67s
material-ui - node (v14.15.1, x64)
Memory used 471,994k (± 0.05%) 471,786k (± 0.04%) -208k (- 0.04%) 471,644k 472,303k
Parse Time 2.14s (± 0.82%) 2.14s (± 0.62%) +0.01s (+ 0.28%) 2.11s 2.17s
Bind Time 0.69s (± 0.00%) 0.69s (± 0.89%) +0.00s (+ 0.14%) 0.68s 0.70s
Check Time 12.68s (± 0.79%) 12.74s (± 0.91%) +0.06s (+ 0.45%) 12.51s 13.05s
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) 0.00s ( NaN%) 0.00s 0.00s
Total Time 15.51s (± 0.67%) 15.58s (± 0.74%) +0.06s (+ 0.41%) 15.35s 15.89s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-198-generic
Architecturex64
Available Memory16 GB
Available Memory8 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)
Benchmark Name Iterations
Current 42524 10
Baseline master 10

@typescript-bot
Copy link
Collaborator

The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master.

@craigkovatch
Copy link

@DanielRosenwasser when was #34793 "already fixed"? I still see it same as I always did :(

@DanielRosenwasser
Copy link
Member

It might not have - have you checked the nightlies with npm install typescript@next?

My assumption was it would've been fixed with #42284 where we'll preserve the origin types to remember that something was written as Omit.

@craigkovatch
Copy link

@DanielRosenwasser ah ok, no I haven't checked any nightlies, I badly assumed you meant in a public release. I'll check and report back.

src/lib/es5.d.ts Outdated Show resolved Hide resolved
@sandersn sandersn added this to Not started in PR Backlog Feb 8, 2021
@sandersn
Copy link
Member

Unfortunately, we never finished reviewing this PR. It is pretty old now, so I'm going to close it to reduce the number of open PRs.

@sandersn sandersn closed this May 26, 2022
PR Backlog automation moved this from Waiting on reviewers to Done May 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Archived in project
PR Backlog
  
Done
6 participants