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

Update type-only import semantics to allow type queries #36092

Open
wants to merge 25 commits into
base: master
from

Conversation

@andrewbranch
Copy link
Member

andrewbranch commented Jan 9, 2020

In #35200, a type-only import or export created a synthetic symbol which reflected only the type-side meaning of its target. This meant that the imported names were unusable in any value position. This PR removes the intermediate synthetic symbol and instead issues an error if the imported names appear in any non-ambient expression context. Namely, this allows for:

import type { BaseClass } from './base';

// 1. Type queries
let ConstructorType: typeof BaseClass;

// 2. Ambient contexts that require value meanings
declare class SubClass extends BaseClass {}

One oddity that arises with this approach is how to treat a namespace import that includes type-only exports:

// a.ts
class A {}
export type { A }

// b.ts
import * as a from './a';
console.log(a); // Empty object, because the export type was erased

type T = keyof typeof a; // `never` - because `typeof a` must be an empty object type

let a: a.A; // This is ok
let A: typeof a.A; // This doesn’t work because `typeof a` is an empty object :(

Essentially, there is a limitation that if you need to access the value meaning of a type-only export, you can’t do so through a namespace import—you have to use a named (or default) import.

The distinction is subtle and confusing, but I think internally consistent, and unlikely to come up much in real code. At least, I think it’s better to start with this limitation than to be overly permissive in a way that could make the type system misrepresent the reality of the shape of a module.


Fixes #36040
Fixes #36003 (the part I said was a bug)
Fixes #36004

andrewbranch added 8 commits Jan 8, 2020
src/compiler/checker.ts Outdated Show resolved Hide resolved
@andrewbranch andrewbranch marked this pull request as ready for review Jan 9, 2020
Copy link
Member

sandersn left a comment

The change looks OK to me, but with the caveat the I didn't review the original code so this is the first time for me to look at it. @weswigham should probably answer your question about whether there's a better way to finagle const enum references.

@andrewbranch

This comment has been minimized.

Copy link
Member Author

andrewbranch commented Jan 9, 2020

@typescript-bot perf test this

@typescript-bot

This comment has been minimized.

Copy link
Collaborator

typescript-bot commented Jan 9, 2020

Heya @andrewbranch, I've started to run the perf test suite on this PR at 124dcd6. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!

@typescript-bot

This comment has been minimized.

Copy link
Collaborator

typescript-bot commented Jan 9, 2020

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

Here they are:

Comparison Report - master..36092

Metric master 36092 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 356,335k (± 0.02%) 358,325k (± 0.02%) +1,990k (+ 0.56%) 358,120k 358,466k
Parse Time 1.61s (± 0.52%) 1.62s (± 0.41%) +0.01s (+ 0.56%) 1.60s 1.63s
Bind Time 0.87s (± 1.17%) 0.88s (± 0.96%) +0.01s (+ 0.92%) 0.86s 0.89s
Check Time 4.59s (± 0.45%) 4.76s (± 0.49%) +0.17s (+ 3.77%) 4.71s 4.82s
Emit Time 5.29s (± 0.99%) 5.27s (± 0.87%) -0.02s (- 0.47%) 5.13s 5.38s
Total Time 12.36s (± 0.51%) 12.53s (± 0.57%) +0.17s (+ 1.35%) 12.32s 12.71s
Monaco - node (v10.16.3, x64)
Memory used 367,758k (± 0.02%) 367,890k (± 0.01%) +132k (+ 0.04%) 367,799k 368,006k
Parse Time 1.26s (± 0.59%) 1.25s (± 0.80%) -0.01s (- 0.56%) 1.23s 1.28s
Bind Time 0.76s (± 0.48%) 0.76s (± 0.53%) -0.01s (- 0.65%) 0.75s 0.77s
Check Time 4.71s (± 0.51%) 4.83s (± 0.61%) +0.12s (+ 2.55%) 4.76s 4.88s
Emit Time 2.95s (± 0.56%) 2.97s (± 0.90%) +0.02s (+ 0.58%) 2.91s 3.02s
Total Time 9.68s (± 0.44%) 9.81s (± 0.49%) +0.13s (+ 1.33%) 9.69s 9.89s
TFS - node (v10.16.3, x64)
Memory used 323,446k (± 0.02%) 323,642k (± 0.02%) +196k (+ 0.06%) 323,477k 323,795k
Parse Time 0.95s (± 0.61%) 0.94s (± 0.50%) -0.00s (- 0.42%) 0.93s 0.95s
Bind Time 0.74s (± 0.88%) 0.73s (± 1.09%) -0.01s (- 0.81%) 0.71s 0.75s
Check Time 4.17s (± 0.32%) 4.29s (± 0.35%) +0.12s (+ 2.90%) 4.26s 4.33s
Emit Time 3.03s (± 0.88%) 3.04s (± 0.88%) +0.01s (+ 0.16%) 2.98s 3.09s
Total Time 8.89s (± 0.34%) 9.01s (± 0.45%) +0.12s (+ 1.32%) 8.94s 9.10s
Angular - node (v12.1.0, x64)
Memory used 331,969k (± 0.03%) 333,964k (± 0.05%) +1,996k (+ 0.60%) 333,295k 334,170k
Parse Time 1.56s (± 0.74%) 1.57s (± 0.61%) +0.00s (+ 0.19%) 1.55s 1.59s
Bind Time 0.84s (± 0.81%) 0.86s (± 0.68%) +0.01s (+ 1.42%) 0.84s 0.87s
Check Time 4.54s (± 0.45%) 4.72s (± 0.47%) +0.17s (+ 3.83%) 4.66s 4.76s
Emit Time 5.52s (± 0.95%) 5.50s (± 0.55%) -0.02s (- 0.45%) 5.45s 5.58s
Total Time 12.47s (± 0.41%) 12.64s (± 0.33%) +0.16s (+ 1.29%) 12.55s 12.74s
Monaco - node (v12.1.0, x64)
Memory used 347,547k (± 0.02%) 347,684k (± 0.01%) +137k (+ 0.04%) 347,559k 347,781k
Parse Time 1.22s (± 0.39%) 1.23s (± 0.99%) +0.00s (+ 0.41%) 1.20s 1.26s
Bind Time 0.73s (± 0.91%) 0.73s (± 0.79%) +0.00s (+ 0.00%) 0.72s 0.75s
Check Time 4.55s (± 0.51%) 4.67s (± 0.60%) +0.12s (+ 2.52%) 4.59s 4.73s
Emit Time 2.99s (± 0.67%) 3.03s (± 0.62%) +0.05s (+ 1.57%) 2.99s 3.07s
Total Time 9.50s (± 0.31%) 9.66s (± 0.34%) +0.17s (+ 1.75%) 9.57s 9.73s
TFS - node (v12.1.0, x64)
Memory used 305,787k (± 0.01%) 305,917k (± 0.02%) +131k (+ 0.04%) 305,711k 306,046k
Parse Time 0.94s (± 1.00%) 0.93s (± 0.40%) -0.01s (- 0.53%) 0.93s 0.94s
Bind Time 0.69s (± 0.65%) 0.70s (± 2.66%) +0.01s (+ 1.60%) 0.68s 0.76s
Check Time 4.12s (± 0.41%) 4.21s (± 0.61%) +0.09s (+ 2.28%) 4.16s 4.27s
Emit Time 3.07s (± 0.66%) 3.11s (± 0.77%) +0.04s (+ 1.37%) 3.05s 3.16s
Total Time 8.81s (± 0.37%) 8.95s (± 0.55%) +0.14s (+ 1.58%) 8.84s 9.04s
Angular - node (v8.9.0, x64)
Memory used 351,256k (± 0.02%) 353,222k (± 0.01%) +1,965k (+ 0.56%) 353,132k 353,317k
Parse Time 2.11s (± 0.65%) 2.11s (± 0.45%) +0.00s (+ 0.05%) 2.09s 2.13s
Bind Time 0.91s (± 0.83%) 0.93s (± 0.81%) +0.01s (+ 1.42%) 0.91s 0.94s
Check Time 5.40s (± 0.55%) 5.58s (± 0.35%) +0.18s (+ 3.28%) 5.50s 5.60s
Emit Time 6.30s (± 0.82%) 6.29s (± 0.92%) -0.01s (- 0.19%) 6.16s 6.45s
Total Time 14.71s (± 0.59%) 14.90s (± 0.44%) +0.19s (+ 1.26%) 14.78s 15.08s
Monaco - node (v8.9.0, x64)
Memory used 365,985k (± 0.01%) 366,116k (± 0.01%) +132k (+ 0.04%) 365,987k 366,218k
Parse Time 1.56s (± 0.41%) 1.56s (± 0.36%) -0.00s (- 0.26%) 1.55s 1.57s
Bind Time 0.95s (± 0.74%) 0.94s (± 0.90%) -0.01s (- 0.84%) 0.92s 0.96s
Check Time 5.44s (± 1.61%) 5.64s (± 1.40%) +0.21s (+ 3.83%) 5.51s 5.81s
Emit Time 3.34s (± 4.58%) 3.28s (± 4.43%) -0.06s (- 1.91%) 3.01s 3.45s
Total Time 11.29s (± 0.81%) 11.43s (± 0.74%) +0.14s (+ 1.20%) 11.24s 11.56s
TFS - node (v8.9.0, x64)
Memory used 322,752k (± 0.01%) 322,828k (± 0.01%) +76k (+ 0.02%) 322,733k 322,914k
Parse Time 1.27s (± 0.29%) 1.26s (± 0.54%) -0.00s (- 0.08%) 1.25s 1.28s
Bind Time 0.75s (± 0.78%) 0.75s (± 1.09%) 0.00s ( 0.00%) 0.73s 0.77s
Check Time 4.78s (± 0.84%) 4.88s (± 0.75%) +0.10s (+ 2.09%) 4.80s 4.95s
Emit Time 3.22s (± 0.71%) 3.22s (± 0.48%) -0.00s (- 0.06%) 3.19s 3.27s
Total Time 10.01s (± 0.57%) 10.11s (± 0.50%) +0.10s (+ 0.99%) 10.00s 10.21s
Angular - node (v8.9.0, x86)
Memory used 199,561k (± 0.02%) 200,605k (± 0.03%) +1,044k (+ 0.52%) 200,428k 200,737k
Parse Time 2.04s (± 0.56%) 2.03s (± 0.47%) -0.00s (- 0.20%) 2.02s 2.06s
Bind Time 1.02s (± 0.47%) 1.03s (± 0.74%) +0.01s (+ 0.88%) 1.01s 1.05s
Check Time 4.91s (± 0.68%) 5.08s (± 0.62%) +0.16s (+ 3.32%) 5.01s 5.16s
Emit Time 6.15s (± 1.43%) 6.19s (± 1.98%) +0.03s (+ 0.55%) 6.01s 6.48s
Total Time 14.12s (± 0.59%) 14.32s (± 0.96%) +0.20s (+ 1.44%) 14.11s 14.65s
Monaco - node (v8.9.0, x86)
Memory used 205,223k (± 0.02%) 205,326k (± 0.02%) +103k (+ 0.05%) 205,233k 205,452k
Parse Time 1.61s (± 0.81%) 1.60s (± 0.57%) -0.01s (- 0.62%) 1.59s 1.63s
Bind Time 0.76s (± 1.19%) 0.75s (± 1.10%) -0.01s (- 0.66%) 0.74s 0.77s
Check Time 5.36s (± 2.05%) 5.60s (± 1.07%) +0.24s (+ 4.51%) 5.39s 5.68s
Emit Time 3.02s (± 4.43%) 2.90s (± 3.26%) -0.12s (- 4.04%) 2.80s 3.27s
Total Time 10.74s (± 0.46%) 10.85s (± 0.51%) +0.11s (+ 1.02%) 10.72s 11.03s
TFS - node (v8.9.0, x86)
Memory used 182,069k (± 0.03%) 182,139k (± 0.02%) +70k (+ 0.04%) 182,065k 182,202k
Parse Time 1.30s (± 0.73%) 1.30s (± 0.68%) -0.00s (- 0.31%) 1.29s 1.33s
Bind Time 0.70s (± 0.42%) 0.71s (± 1.32%) +0.01s (+ 1.14%) 0.70s 0.74s
Check Time 4.54s (± 0.73%) 4.63s (± 0.85%) +0.08s (+ 1.78%) 4.56s 4.75s
Emit Time 2.98s (± 0.92%) 2.99s (± 0.70%) +0.00s (+ 0.17%) 2.94s 3.02s
Total Time 9.53s (± 0.38%) 9.62s (± 0.56%) +0.09s (+ 0.94%) 9.52s 9.79s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory5 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
Benchmark Name Iterations
Current 36092 10
Baseline master 10

@andrewbranch

This comment has been minimized.

Copy link
Member Author

andrewbranch commented Jan 9, 2020

Check time appears up ~2–4%. I think this discussion will have some bearing on what we can do, so I’ll hold off on doing anything specifically for perf until we make some other decisions.

@andrewbranch

This comment was marked as outdated.

Copy link
Member Author

andrewbranch commented Jan 10, 2020

@typescript-bot perf test this

@typescript-bot

This comment was marked as outdated.

Copy link
Collaborator

typescript-bot commented Jan 10, 2020

Heya @andrewbranch, I've started to run the perf test suite on this PR at 2dd3690. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!

@typescript-bot

This comment was marked as outdated.

Copy link
Collaborator

typescript-bot commented Jan 10, 2020

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

Here they are:

Comparison Report - master..36092

Metric master 36092 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 356,283k (± 0.02%) 358,293k (± 0.02%) +2,010k (+ 0.56%) 358,126k 358,487k
Parse Time 1.60s (± 0.56%) 1.63s (± 0.49%) +0.02s (+ 1.43%) 1.61s 1.64s
Bind Time 0.87s (± 0.60%) 0.89s (± 1.02%) +0.02s (+ 2.30%) 0.87s 0.91s
Check Time 4.58s (± 0.42%) 4.77s (± 0.85%) +0.19s (+ 4.19%) 4.67s 4.89s
Emit Time 5.26s (± 0.60%) 5.32s (± 0.69%) +0.06s (+ 1.14%) 5.22s 5.36s
Total Time 12.32s (± 0.22%) 12.61s (± 0.60%) +0.29s (+ 2.38%) 12.39s 12.78s
Monaco - node (v10.16.3, x64)
Memory used 367,772k (± 0.01%) 367,909k (± 0.02%) +137k (+ 0.04%) 367,794k 368,061k
Parse Time 1.26s (± 0.84%) 1.25s (± 0.76%) -0.00s (- 0.24%) 1.23s 1.28s
Bind Time 0.77s (± 0.68%) 0.76s (± 0.58%) -0.01s (- 0.91%) 0.76s 0.78s
Check Time 4.69s (± 0.68%) 4.82s (± 0.44%) +0.13s (+ 2.66%) 4.76s 4.86s
Emit Time 2.95s (± 0.53%) 2.99s (± 1.72%) +0.04s (+ 1.29%) 2.91s 3.16s
Total Time 9.66s (± 0.56%) 9.82s (± 0.67%) +0.15s (+ 1.59%) 9.68s 9.98s
TFS - node (v10.16.3, x64)
Memory used 323,460k (± 0.03%) 323,585k (± 0.01%) +125k (+ 0.04%) 323,493k 323,691k
Parse Time 0.96s (± 0.72%) 0.95s (± 0.77%) -0.01s (- 0.73%) 0.94s 0.97s
Bind Time 0.74s (± 1.82%) 0.73s (± 1.21%) -0.01s (- 1.09%) 0.71s 0.74s
Check Time 4.17s (± 0.40%) 4.29s (± 0.72%) +0.12s (+ 2.75%) 4.24s 4.38s
Emit Time 3.04s (± 0.55%) 3.02s (± 0.88%) -0.02s (- 0.69%) 2.97s 3.08s
Total Time 8.90s (± 0.31%) 8.99s (± 0.35%) +0.08s (+ 0.92%) 8.92s 9.05s
Angular - node (v12.1.0, x64)
Memory used 332,000k (± 0.02%) 333,883k (± 0.02%) +1,883k (+ 0.57%) 333,665k 333,971k
Parse Time 1.56s (± 0.61%) 1.59s (± 0.69%) +0.03s (+ 1.66%) 1.57s 1.62s
Bind Time 0.85s (± 0.76%) 0.86s (± 0.67%) +0.01s (+ 0.94%) 0.85s 0.87s
Check Time 4.53s (± 0.40%) 4.71s (± 0.53%) +0.18s (+ 4.04%) 4.66s 4.77s
Emit Time 5.50s (± 0.95%) 5.50s (± 0.44%) +0.00s (+ 0.05%) 5.44s 5.56s
Total Time 12.44s (± 0.54%) 12.66s (± 0.29%) +0.22s (+ 1.77%) 12.58s 12.75s
Monaco - node (v12.1.0, x64)
Memory used 347,501k (± 0.01%) 347,566k (± 0.01%) +65k (+ 0.02%) 347,508k 347,657k
Parse Time 1.21s (± 0.56%) 1.23s (± 0.56%) +0.01s (+ 0.99%) 1.21s 1.24s
Bind Time 0.73s (± 0.61%) 0.73s (± 0.61%) 0.00s ( 0.00%) 0.72s 0.74s
Check Time 4.56s (± 0.35%) 4.67s (± 0.36%) +0.11s (+ 2.37%) 4.62s 4.71s
Emit Time 3.01s (± 0.53%) 3.02s (± 1.11%) +0.01s (+ 0.27%) 2.97s 3.13s
Total Time 9.52s (± 0.29%) 9.64s (± 0.41%) +0.13s (+ 1.33%) 9.55s 9.75s
TFS - node (v12.1.0, x64)
Memory used 305,808k (± 0.02%) 305,796k (± 0.02%) -13k (- 0.00%) 305,680k 305,890k
Parse Time 0.94s (± 0.77%) 0.94s (± 0.75%) -0.00s (- 0.32%) 0.92s 0.96s
Bind Time 0.69s (± 0.86%) 0.69s (± 0.89%) -0.00s (- 0.43%) 0.68s 0.71s
Check Time 4.09s (± 0.45%) 4.24s (± 0.41%) +0.15s (+ 3.64%) 4.21s 4.27s
Emit Time 3.07s (± 0.73%) 3.07s (± 0.80%) -0.00s (- 0.03%) 3.00s 3.12s
Total Time 8.79s (± 0.38%) 8.93s (± 0.34%) +0.14s (+ 1.60%) 8.87s 9.01s
Angular - node (v8.9.0, x64)
Memory used 351,276k (± 0.02%) 353,131k (± 0.01%) +1,856k (+ 0.53%) 353,041k 353,228k
Parse Time 2.09s (± 0.23%) 2.12s (± 0.45%) +0.02s (+ 1.05%) 2.10s 2.14s
Bind Time 0.91s (± 1.21%) 0.93s (± 0.70%) +0.01s (+ 1.64%) 0.91s 0.94s
Check Time 5.39s (± 0.54%) 5.58s (± 0.82%) +0.19s (+ 3.47%) 5.45s 5.65s
Emit Time 6.24s (± 0.62%) 6.28s (± 0.89%) +0.03s (+ 0.53%) 6.17s 6.44s
Total Time 14.64s (± 0.36%) 14.90s (± 0.47%) +0.26s (+ 1.78%) 14.74s 15.07s
Monaco - node (v8.9.0, x64)
Memory used 365,919k (± 0.01%) 366,076k (± 0.01%) +157k (+ 0.04%) 365,957k 366,165k
Parse Time 1.56s (± 0.57%) 1.56s (± 0.44%) 0.00s ( 0.00%) 1.55s 1.58s
Bind Time 0.95s (± 1.02%) 0.94s (± 0.94%) -0.00s (- 0.53%) 0.93s 0.97s
Check Time 5.42s (± 1.08%) 5.64s (± 1.59%) +0.22s (+ 4.00%) 5.51s 5.87s
Emit Time 3.40s (± 4.12%) 3.31s (± 4.35%) -0.09s (- 2.53%) 3.06s 3.50s
Total Time 11.33s (± 0.97%) 11.46s (± 0.74%) +0.13s (+ 1.15%) 11.23s 11.61s
TFS - node (v8.9.0, x64)
Memory used 322,743k (± 0.01%) 322,854k (± 0.01%) +112k (+ 0.03%) 322,773k 322,912k
Parse Time 1.26s (± 0.49%) 1.26s (± 0.46%) +0.00s (+ 0.16%) 1.25s 1.27s
Bind Time 0.75s (± 0.77%) 0.75s (± 0.77%) -0.00s (- 0.00%) 0.74s 0.76s
Check Time 4.75s (± 0.91%) 4.86s (± 0.47%) +0.10s (+ 2.17%) 4.81s 4.93s
Emit Time 3.21s (± 0.52%) 3.19s (± 0.92%) -0.02s (- 0.50%) 3.12s 3.24s
Total Time 9.97s (± 0.60%) 10.07s (± 0.44%) +0.09s (+ 0.91%) 9.99s 10.18s
Angular - node (v8.9.0, x86)
Memory used 199,575k (± 0.02%) 200,570k (± 0.03%) +995k (+ 0.50%) 200,459k 200,726k
Parse Time 2.02s (± 0.60%) 2.04s (± 0.85%) +0.02s (+ 0.99%) 2.01s 2.10s
Bind Time 1.03s (± 0.84%) 1.03s (± 0.78%) 0.00s ( 0.00%) 1.01s 1.05s
Check Time 4.88s (± 0.37%) 5.05s (± 0.66%) +0.16s (+ 3.32%) 5.00s 5.13s
Emit Time 6.20s (± 2.19%) 6.24s (± 2.18%) +0.04s (+ 0.69%) 6.01s 6.50s
Total Time 14.13s (± 1.07%) 14.36s (± 1.11%) +0.23s (+ 1.61%) 14.07s 14.72s
Monaco - node (v8.9.0, x86)
Memory used 205,154k (± 0.02%) 205,262k (± 0.03%) +108k (+ 0.05%) 205,127k 205,391k
Parse Time 1.60s (± 0.62%) 1.61s (± 0.50%) +0.01s (+ 0.63%) 1.59s 1.63s
Bind Time 0.76s (± 1.06%) 0.76s (± 0.62%) +0.00s (+ 0.26%) 0.75s 0.77s
Check Time 5.40s (± 1.70%) 5.56s (± 1.81%) +0.16s (+ 3.00%) 5.33s 5.69s
Emit Time 2.94s (± 4.05%) 2.98s (± 4.49%) +0.05s (+ 1.60%) 2.83s 3.27s
Total Time 10.69s (± 0.45%) 10.92s (± 0.52%) +0.23s (+ 2.10%) 10.73s 11.02s
TFS - node (v8.9.0, x86)
Memory used 182,089k (± 0.01%) 182,145k (± 0.02%) +56k (+ 0.03%) 182,072k 182,200k
Parse Time 1.30s (± 0.85%) 1.31s (± 1.01%) +0.01s (+ 0.38%) 1.29s 1.35s
Bind Time 0.71s (± 0.82%) 0.70s (± 0.92%) -0.01s (- 0.71%) 0.69s 0.72s
Check Time 4.50s (± 0.75%) 4.60s (± 0.56%) +0.10s (+ 2.22%) 4.55s 4.66s
Emit Time 2.99s (± 1.34%) 2.98s (± 0.93%) -0.01s (- 0.43%) 2.91s 3.05s
Total Time 9.51s (± 0.54%) 9.60s (± 0.41%) +0.09s (+ 0.96%) 9.53s 9.70s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory5 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
Benchmark Name Iterations
Current 36092 10
Baseline master 10

@andrewbranch

This comment was marked as outdated.

Copy link
Member Author

andrewbranch commented Jan 10, 2020

@typescript-bot perf test this

@andrewbranch andrewbranch changed the title Update type-only import semantics to allow type queries WIP(perf): Update type-only import semantics to allow type queries Jan 10, 2020
@andrewbranch andrewbranch changed the title WIP(perf): Update type-only import semantics to allow type queries WIP (perf): Update type-only import semantics to allow type queries Jan 10, 2020
@typescript-bot

This comment was marked as outdated.

Copy link
Collaborator

typescript-bot commented Jan 10, 2020

Heya @andrewbranch, I've started to run the perf test suite on this PR at eefa335. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!

@typescript-bot

This comment was marked as outdated.

Copy link
Collaborator

typescript-bot commented Jan 14, 2020

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

Here they are:

Comparison Report - master..36092

Metric master 36092 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 356,280k (± 0.02%) 358,004k (± 0.01%) +1,724k (+ 0.48%) 357,886k 358,094k
Parse Time 1.61s (± 0.76%) 1.63s (± 0.52%) +0.02s (+ 1.24%) 1.61s 1.65s
Bind Time 0.87s (± 0.56%) 0.88s (± 0.76%) +0.01s (+ 1.03%) 0.87s 0.90s
Check Time 4.59s (± 0.67%) 4.67s (± 0.51%) +0.08s (+ 1.74%) 4.61s 4.72s
Emit Time 5.25s (± 0.80%) 5.29s (± 0.84%) +0.05s (+ 0.93%) 5.23s 5.42s
Total Time 12.32s (± 0.53%) 12.48s (± 0.53%) +0.16s (+ 1.30%) 12.35s 12.68s
Monaco - node (v10.16.3, x64)
Memory used 367,710k (± 0.02%) 367,725k (± 0.02%) +15k (+ 0.00%) 367,537k 367,885k
Parse Time 1.25s (± 0.75%) 1.26s (± 0.65%) +0.01s (+ 0.80%) 1.24s 1.28s
Bind Time 0.76s (± 0.48%) 0.76s (± 0.49%) +0.00s (+ 0.13%) 0.76s 0.77s
Check Time 4.70s (± 0.71%) 4.76s (± 0.85%) +0.07s (+ 1.41%) 4.67s 4.83s
Emit Time 2.92s (± 0.85%) 2.96s (± 0.49%) +0.04s (+ 1.37%) 2.92s 2.99s
Total Time 9.63s (± 0.61%) 9.75s (± 0.61%) +0.12s (+ 1.20%) 9.62s 9.86s
TFS - node (v10.16.3, x64)
Memory used 323,509k (± 0.02%) 323,473k (± 0.02%) -36k (- 0.01%) 323,365k 323,643k
Parse Time 0.95s (± 0.52%) 0.96s (± 0.54%) +0.02s (+ 1.59%) 0.95s 0.97s
Bind Time 0.73s (± 0.91%) 0.73s (± 1.69%) -0.00s (- 0.27%) 0.70s 0.75s
Check Time 4.17s (± 0.71%) 4.24s (± 0.31%) +0.07s (+ 1.56%) 4.20s 4.27s
Emit Time 3.02s (± 0.50%) 3.04s (± 1.27%) +0.02s (+ 0.60%) 2.94s 3.14s
Total Time 8.87s (± 0.41%) 8.97s (± 0.47%) +0.09s (+ 1.06%) 8.89s 9.07s
Angular - node (v12.1.0, x64)
Memory used 331,968k (± 0.03%) 333,701k (± 0.02%) +1,734k (+ 0.52%) 333,596k 333,806k
Parse Time 1.57s (± 0.30%) 1.58s (± 0.66%) +0.01s (+ 0.57%) 1.55s 1.60s
Bind Time 0.85s (± 0.68%) 0.86s (± 0.79%) +0.02s (+ 1.76%) 0.85s 0.88s
Check Time 4.53s (± 0.63%) 4.59s (± 0.54%) +0.05s (+ 1.19%) 4.53s 4.64s
Emit Time 5.48s (± 0.72%) 5.51s (± 0.83%) +0.03s (+ 0.58%) 5.40s 5.65s
Total Time 12.43s (± 0.44%) 12.55s (± 0.56%) +0.11s (+ 0.92%) 12.38s 12.75s
Monaco - node (v12.1.0, x64)
Memory used 347,472k (± 0.02%) 347,540k (± 0.01%) +69k (+ 0.02%) 347,414k 347,647k
Parse Time 1.22s (± 0.68%) 1.24s (± 0.62%) +0.01s (+ 0.90%) 1.22s 1.25s
Bind Time 0.74s (± 0.81%) 0.74s (± 1.34%) +0.00s (+ 0.41%) 0.72s 0.77s
Check Time 4.56s (± 0.39%) 4.62s (± 0.39%) +0.06s (+ 1.27%) 4.57s 4.66s
Emit Time 3.01s (± 0.62%) 3.02s (± 1.06%) +0.01s (+ 0.50%) 2.97s 3.13s
Total Time 9.53s (± 0.37%) 9.62s (± 0.38%) +0.09s (+ 0.94%) 9.56s 9.74s
TFS - node (v12.1.0, x64)
Memory used 305,740k (± 0.01%) 305,814k (± 0.02%) +74k (+ 0.02%) 305,701k 305,926k
Parse Time 0.95s (± 1.12%) 0.95s (± 0.79%) +0.00s (+ 0.11%) 0.93s 0.96s
Bind Time 0.69s (± 0.58%) 0.69s (± 1.50%) +0.00s (+ 0.14%) 0.68s 0.73s
Check Time 4.11s (± 0.48%) 4.16s (± 0.47%) +0.05s (+ 1.31%) 4.10s 4.20s
Emit Time 3.09s (± 0.59%) 3.10s (± 0.55%) +0.01s (+ 0.36%) 3.07s 3.14s
Total Time 8.83s (± 0.42%) 8.90s (± 0.33%) +0.07s (+ 0.79%) 8.83s 8.95s
Angular - node (v8.9.0, x64)
Memory used 351,254k (± 0.01%) 352,926k (± 0.01%) +1,672k (+ 0.48%) 352,818k 353,015k
Parse Time 2.09s (± 0.47%) 2.12s (± 0.70%) +0.03s (+ 1.53%) 2.09s 2.16s
Bind Time 0.91s (± 0.63%) 0.93s (± 0.83%) +0.02s (+ 2.09%) 0.91s 0.95s
Check Time 5.39s (± 0.83%) 5.53s (± 0.50%) +0.14s (+ 2.56%) 5.44s 5.58s
Emit Time 6.28s (± 0.74%) 6.26s (± 0.63%) -0.02s (- 0.30%) 6.15s 6.36s
Total Time 14.67s (± 0.54%) 14.84s (± 0.45%) +0.17s (+ 1.15%) 14.68s 15.03s
Monaco - node (v8.9.0, x64)
Memory used 365,912k (± 0.01%) 365,900k (± 0.02%) -13k (- 0.00%) 365,772k 366,019k
Parse Time 1.56s (± 0.43%) 1.56s (± 0.44%) +0.00s (+ 0.06%) 1.55s 1.58s
Bind Time 0.95s (± 0.84%) 0.96s (± 0.99%) +0.01s (+ 0.84%) 0.93s 0.98s
Check Time 5.42s (± 1.93%) 5.51s (± 1.66%) +0.09s (+ 1.66%) 5.36s 5.71s
Emit Time 3.36s (± 4.68%) 3.37s (± 3.89%) +0.01s (+ 0.21%) 3.09s 3.52s
Total Time 11.29s (± 0.65%) 11.40s (± 0.53%) +0.11s (+ 0.94%) 11.25s 11.50s
TFS - node (v8.9.0, x64)
Memory used 322,729k (± 0.01%) 322,711k (± 0.01%) -18k (- 0.01%) 322,580k 322,816k
Parse Time 1.26s (± 0.51%) 1.26s (± 0.44%) -0.00s (- 0.00%) 1.25s 1.27s
Bind Time 0.74s (± 0.67%) 0.75s (± 0.91%) +0.00s (+ 0.13%) 0.73s 0.76s
Check Time 4.75s (± 0.53%) 4.84s (± 0.60%) +0.09s (+ 1.90%) 4.79s 4.89s
Emit Time 3.20s (± 0.77%) 3.21s (± 0.89%) +0.01s (+ 0.19%) 3.13s 3.27s
Total Time 9.96s (± 0.48%) 10.06s (± 0.48%) +0.10s (+ 0.98%) 9.92s 10.15s
Angular - node (v8.9.0, x86)
Memory used 199,561k (± 0.02%) 200,458k (± 0.02%) +897k (+ 0.45%) 200,401k 200,529k
Parse Time 2.02s (± 0.43%) 2.06s (± 0.76%) +0.03s (+ 1.68%) 2.03s 2.10s
Bind Time 1.02s (± 0.60%) 1.02s (± 0.63%) +0.00s (+ 0.10%) 1.01s 1.04s
Check Time 4.92s (± 0.70%) 5.03s (± 0.46%) +0.11s (+ 2.32%) 4.97s 5.08s
Emit Time 6.06s (± 1.19%) 6.25s (± 2.04%) +0.19s (+ 3.09%) 6.00s 6.45s
Total Time 14.02s (± 0.68%) 14.36s (± 0.91%) +0.34s (+ 2.39%) 14.13s 14.58s
Monaco - node (v8.9.0, x86)
Memory used 205,163k (± 0.02%) 205,203k (± 0.02%) +40k (+ 0.02%) 205,119k 205,275k
Parse Time 1.61s (± 0.99%) 1.62s (± 0.50%) +0.01s (+ 0.75%) 1.61s 1.64s
Bind Time 0.76s (± 0.92%) 0.76s (± 0.62%) +0.00s (+ 0.13%) 0.75s 0.77s
Check Time 5.44s (± 0.48%) 5.55s (± 0.68%) +0.11s (+ 2.02%) 5.46s 5.63s
Emit Time 2.86s (± 0.87%) 2.89s (± 0.79%) +0.03s (+ 0.98%) 2.84s 2.94s
Total Time 10.66s (± 0.49%) 10.81s (± 0.41%) +0.15s (+ 1.43%) 10.70s 10.92s
TFS - node (v8.9.0, x86)
Memory used 182,105k (± 0.02%) 182,084k (± 0.01%) -21k (- 0.01%) 182,035k 182,149k
Parse Time 1.30s (± 0.70%) 1.33s (± 1.07%) +0.03s (+ 1.92%) 1.30s 1.35s
Bind Time 0.71s (± 0.95%) 0.71s (± 1.13%) +0.00s (+ 0.14%) 0.69s 0.73s
Check Time 4.52s (± 0.59%) 4.61s (± 0.58%) +0.08s (+ 1.81%) 4.55s 4.68s
Emit Time 2.97s (± 1.02%) 3.01s (± 1.34%) +0.05s (+ 1.65%) 2.94s 3.14s
Total Time 9.50s (± 0.29%) 9.65s (± 0.44%) +0.16s (+ 1.65%) 9.54s 9.77s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory5 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
Benchmark Name Iterations
Current 36092 10
Baseline master 10

@andrewbranch

This comment has been minimized.

Copy link
Member Author

andrewbranch commented Jan 14, 2020

@typescript-bot perf test this

@typescript-bot

This comment has been minimized.

Copy link
Collaborator

typescript-bot commented Jan 14, 2020

Heya @andrewbranch, I've started to run the perf test suite on this PR at 40a2c3c. You can monitor the build here. It should now contribute to this PR's status checks.

Update: The results are in!

@typescript-bot

This comment has been minimized.

Copy link
Collaborator

typescript-bot commented Jan 14, 2020

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

Here they are:

Comparison Report - master..36092

Metric master 36092 Delta Best Worst
Angular - node (v10.16.3, x64)
Memory used 356,280k (± 0.02%) 357,991k (± 0.01%) +1,712k (+ 0.48%) 357,925k 358,071k
Parse Time 1.61s (± 0.76%) 1.64s (± 0.72%) +0.03s (+ 1.92%) 1.61s 1.66s
Bind Time 0.87s (± 0.56%) 0.88s (± 0.76%) +0.01s (+ 1.03%) 0.87s 0.90s
Check Time 4.59s (± 0.67%) 4.62s (± 0.67%) +0.03s (+ 0.68%) 4.56s 4.68s
Emit Time 5.25s (± 0.80%) 5.30s (± 0.86%) +0.06s (+ 1.12%) 5.24s 5.47s
Total Time 12.32s (± 0.53%) 12.46s (± 0.63%) +0.13s (+ 1.05%) 12.32s 12.71s
Monaco - node (v10.16.3, x64)
Memory used 367,710k (± 0.02%) 367,752k (± 0.01%) +42k (+ 0.01%) 367,644k 367,825k
Parse Time 1.25s (± 0.75%) 1.27s (± 0.37%) +0.02s (+ 1.36%) 1.26s 1.28s
Bind Time 0.76s (± 0.48%) 0.76s (± 0.78%) +0.00s (+ 0.13%) 0.76s 0.78s
Check Time 4.70s (± 0.71%) 4.76s (± 0.45%) +0.07s (+ 1.49%) 4.71s 4.80s
Emit Time 2.92s (± 0.85%) 2.97s (± 0.82%) +0.05s (+ 1.68%) 2.93s 3.05s
Total Time 9.63s (± 0.61%) 9.77s (± 0.43%) +0.14s (+ 1.45%) 9.66s 9.87s
TFS - node (v10.16.3, x64)
Memory used 323,509k (± 0.02%) 323,445k (± 0.01%) -65k (- 0.02%) 323,356k 323,530k
Parse Time 0.95s (± 0.52%) 0.96s (± 0.93%) +0.01s (+ 1.06%) 0.93s 0.97s
Bind Time 0.73s (± 0.91%) 0.74s (± 0.88%) +0.01s (+ 1.10%) 0.72s 0.75s
Check Time 4.17s (± 0.71%) 4.22s (± 0.50%) +0.05s (+ 1.13%) 4.17s 4.28s
Emit Time 3.02s (± 0.50%) 3.06s (± 0.66%) +0.04s (+ 1.16%) 3.02s 3.12s
Total Time 8.87s (± 0.41%) 8.97s (± 0.46%) +0.10s (+ 1.12%) 8.89s 9.09s
Angular - node (v12.1.0, x64)
Memory used 331,968k (± 0.03%) 333,434k (± 0.07%) +1,466k (+ 0.44%) 332,467k 333,638k
Parse Time 1.57s (± 0.30%) 1.58s (± 0.64%) +0.01s (+ 0.70%) 1.57s 1.61s
Bind Time 0.85s (± 0.68%) 0.86s (± 0.69%) +0.01s (+ 1.65%) 0.85s 0.88s
Check Time 4.53s (± 0.63%) 4.56s (± 0.54%) +0.02s (+ 0.53%) 4.52s 4.62s
Emit Time 5.48s (± 0.72%) 5.49s (± 0.87%) +0.01s (+ 0.09%) 5.41s 5.65s
Total Time 12.43s (± 0.44%) 12.49s (± 0.55%) +0.06s (+ 0.46%) 12.37s 12.70s
Monaco - node (v12.1.0, x64)
Memory used 347,472k (± 0.02%) 347,552k (± 0.02%) +81k (+ 0.02%) 347,379k 347,693k
Parse Time 1.22s (± 0.68%) 1.23s (± 0.63%) +0.01s (+ 0.57%) 1.22s 1.25s
Bind Time 0.74s (± 0.81%) 0.74s (± 1.13%) 0.00s ( 0.00%) 0.72s 0.76s
Check Time 4.56s (± 0.39%) 4.62s (± 0.37%) +0.05s (+ 1.16%) 4.59s 4.67s
Emit Time 3.01s (± 0.62%) 3.00s (± 0.44%) -0.01s (- 0.30%) 2.97s 3.02s
Total Time 9.53s (± 0.37%) 9.58s (± 0.33%) +0.05s (+ 0.55%) 9.51s 9.64s
TFS - node (v12.1.0, x64)
Memory used 305,740k (± 0.01%) 305,818k (± 0.02%) +78k (+ 0.03%) 305,669k 305,967k
Parse Time 0.95s (± 1.12%) 0.95s (± 0.80%) +0.00s (+ 0.00%) 0.93s 0.96s
Bind Time 0.69s (± 0.58%) 0.69s (± 0.86%) +0.00s (+ 0.43%) 0.68s 0.71s
Check Time 4.11s (± 0.48%) 4.15s (± 0.38%) +0.04s (+ 1.05%) 4.12s 4.18s
Emit Time 3.09s (± 0.59%) 3.10s (± 0.53%) +0.01s (+ 0.45%) 3.07s 3.14s
Total Time 8.83s (± 0.42%) 8.89s (± 0.35%) +0.06s (+ 0.71%) 8.82s 8.95s
Angular - node (v8.9.0, x64)
Memory used 351,254k (± 0.01%) 352,823k (± 0.01%) +1,568k (+ 0.45%) 352,731k 352,959k
Parse Time 2.09s (± 0.47%) 2.13s (± 0.45%) +0.04s (+ 1.86%) 2.11s 2.15s
Bind Time 0.91s (± 0.63%) 0.94s (± 0.71%) +0.03s (+ 2.97%) 0.92s 0.95s
Check Time 5.39s (± 0.83%) 5.46s (± 0.25%) +0.06s (+ 1.21%) 5.42s 5.48s
Emit Time 6.28s (± 0.74%) 6.28s (± 0.91%) +0.01s (+ 0.11%) 6.17s 6.44s
Total Time 14.67s (± 0.54%) 14.81s (± 0.44%) +0.13s (+ 0.91%) 14.67s 14.98s
Monaco - node (v8.9.0, x64)
Memory used 365,912k (± 0.01%) 365,920k (± 0.01%) +8k (+ 0.00%) 365,806k 366,020k
Parse Time 1.56s (± 0.43%) 1.57s (± 0.30%) +0.00s (+ 0.26%) 1.56s 1.58s
Bind Time 0.95s (± 0.84%) 0.95s (± 1.11%) -0.00s (- 0.11%) 0.93s 0.97s
Check Time 5.42s (± 1.93%) 5.55s (± 1.51%) +0.13s (+ 2.40%) 5.37s 5.69s
Emit Time 3.36s (± 4.68%) 3.24s (± 4.93%) -0.12s (- 3.54%) 3.03s 3.54s
Total Time 11.29s (± 0.65%) 11.31s (± 0.92%) +0.02s (+ 0.16%) 11.14s 11.56s
TFS - node (v8.9.0, x64)
Memory used 322,729k (± 0.01%) 322,737k (± 0.01%) +8k (+ 0.00%) 322,666k 322,820k
Parse Time 1.26s (± 0.51%) 1.27s (± 0.29%) +0.00s (+ 0.32%) 1.26s 1.27s
Bind Time 0.74s (± 0.67%) 0.75s (± 0.63%) +0.01s (+ 0.67%) 0.74s 0.76s
Check Time 4.75s (± 0.53%) 4.83s (± 0.50%) +0.09s (+ 1.83%) 4.78s 4.90s
Emit Time 3.20s (± 0.77%) 3.23s (± 0.85%) +0.03s (+ 0.84%) 3.19s 3.29s
Total Time 9.96s (± 0.48%) 10.08s (± 0.35%) +0.12s (+ 1.21%) 10.00s 10.17s
Angular - node (v8.9.0, x86)
Memory used 199,561k (± 0.02%) 200,372k (± 0.02%) +810k (+ 0.41%) 200,269k 200,455k
Parse Time 2.02s (± 0.43%) 2.06s (± 0.44%) +0.03s (+ 1.63%) 2.04s 2.08s
Bind Time 1.02s (± 0.60%) 1.03s (± 0.68%) +0.01s (+ 0.78%) 1.01s 1.04s
Check Time 4.92s (± 0.70%) 4.90s (± 0.53%) -0.02s (- 0.33%) 4.85s 4.97s
Emit Time 6.06s (± 1.19%) 6.21s (± 2.04%) +0.15s (+ 2.39%) 5.95s 6.42s
Total Time 14.02s (± 0.68%) 14.19s (± 0.88%) +0.17s (+ 1.18%) 13.95s 14.45s
Monaco - node (v8.9.0, x86)
Memory used 205,163k (± 0.02%) 205,175k (± 0.02%) +12k (+ 0.01%) 205,055k 205,260k
Parse Time 1.61s (± 0.99%) 1.61s (± 0.62%) +0.00s (+ 0.31%) 1.59s 1.63s
Bind Time 0.76s (± 0.92%) 0.77s (± 1.97%) +0.01s (+ 1.19%) 0.74s 0.82s
Check Time 5.44s (± 0.48%) 5.47s (± 1.34%) +0.03s (+ 0.61%) 5.20s 5.59s
Emit Time 2.86s (± 0.87%) 2.93s (± 3.39%) +0.07s (+ 2.45%) 2.83s 3.31s
Total Time 10.66s (± 0.49%) 10.78s (± 0.38%) +0.12s (+ 1.14%) 10.70s 10.90s
TFS - node (v8.9.0, x86)
Memory used 182,105k (± 0.02%) 182,085k (± 0.02%) -19k (- 0.01%) 181,992k 182,178k
Parse Time 1.30s (± 0.70%) 1.31s (± 0.96%) +0.01s (+ 0.61%) 1.28s 1.33s
Bind Time 0.71s (± 0.95%) 0.71s (± 0.91%) +0.00s (+ 0.71%) 0.70s 0.73s
Check Time 4.52s (± 0.59%) 4.57s (± 0.44%) +0.04s (+ 0.93%) 4.53s 4.61s
Emit Time 2.97s (± 1.02%) 2.99s (± 1.97%) +0.03s (+ 0.94%) 2.89s 3.17s
Total Time 9.50s (± 0.29%) 9.58s (± 0.81%) +0.09s (+ 0.92%) 9.46s 9.83s
System
Machine Namets-ci-ubuntu
Platformlinux 4.4.0-166-generic
Architecturex64
Available Memory16 GB
Available Memory5 GB
CPUs4 × Intel(R) Core(TM) i7-4770 CPU @ 3.40GHz
Hosts
  • node (v10.16.3, x64)
  • node (v12.1.0, x64)
  • node (v8.9.0, x64)
  • node (v8.9.0, x86)
Scenarios
  • Angular - node (v10.16.3, x64)
  • Angular - node (v12.1.0, x64)
  • Angular - node (v8.9.0, x64)
  • Angular - node (v8.9.0, x86)
  • Monaco - node (v10.16.3, x64)
  • Monaco - node (v12.1.0, x64)
  • Monaco - node (v8.9.0, x64)
  • Monaco - node (v8.9.0, x86)
  • TFS - node (v10.16.3, x64)
  • TFS - node (v12.1.0, x64)
  • TFS - node (v8.9.0, x64)
  • TFS - node (v8.9.0, x86)
Benchmark Name Iterations
Current 36092 10
Baseline master 10

@andrewbranch andrewbranch changed the title WIP (perf): Update type-only import semantics to allow type queries Update type-only import semantics to allow type queries Jan 14, 2020
@andrewbranch andrewbranch requested a review from weswigham Jan 14, 2020
@DanielRosenwasser

This comment has been minimized.

Copy link
Member

DanielRosenwasser commented Jan 15, 2020

@typescript-bot pack this

@typescript-bot

This comment has been minimized.

Copy link
Collaborator

typescript-bot commented Jan 15, 2020

Heya @DanielRosenwasser, I've started to run the tarball bundle task on this PR at 124d746. You can monitor the build here. It should now contribute to this PR's status checks.

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

DanielRosenwasser commented Jan 15, 2020

Hey, is this use-case covered?

// framework-hooks.ts
export const onInit = Symbol("onInit");

//////////

// component.ts
import type { onInit } from "./framework-hooks";

interface Component {
  [onInit]?(): void;
}
@typescript-bot

This comment has been minimized.

Copy link
Collaborator

typescript-bot commented Jan 15, 2020

Hey @DanielRosenwasser, 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/60328/artifacts?artifactName=tgz&fileId=07285DD27C90D89EE948E3E20E9153667A8F648E086FBD99D7C91DBDFE69547202&fileName=/typescript-3.8.0-insiders.20200115.tgz"
    }
}

and then running npm install.


There is also a playground for this build.

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

DanielRosenwasser commented Jan 15, 2020

Yeah, seems like that is another ambient place where values have to be resolved.

Also worth testing in properties on declare class

import type { onInit } from "./framework-hooks";

declare class ConcreteComponent {
  [onInit](): void;
}
@andrewbranch

This comment has been minimized.

Copy link
Member Author

andrewbranch commented Jan 15, 2020

For a moment I thought we could also allow type-only imports in class property declarations without initializers:

class C {
  [onInit]: any;
}

But that’s actually a problem for ES class field semantics if I understand correctly. declare property declarations should Just Work™ because the ambient node flag will propagate down.

It’s also maybe worth noting that at this point, it would be very easy to allow people to use const enums as type-only imports (#36003), even though I think it’s pretty unintuitive.

@DanielRosenwasser

This comment has been minimized.

Copy link
Member

DanielRosenwasser commented Jan 15, 2020

Yeah, that's definitely an error. Here's another fun case now that you mention non-emitted members in classes: abstract members!

import type { onInit } from "./framework-hooks";

abstract class Component {
    abstract [onInit](): void;
}
@andrewbranch

This comment has been minimized.

Copy link
Member Author

andrewbranch commented Jan 15, 2020

@DanielRosenwasser I’ve just updated to include those cases, and switched to a NodeFlag-based approach as @weswigham suggested earlier since the list of syntactic forms to check for in a hot path was growing.

Edit: NodFlag approach was terrible for incremental parsing. Reverted.

@andrewbranch

This comment has been minimized.

Copy link
Member Author

andrewbranch commented Jan 15, 2020

@typescript-bot perf-test this

@andrewbranch andrewbranch force-pushed the andrewbranch:type-only-2 branch from a0691da to a5ca492 Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.