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

Show implied options in --showConfig #56701

Merged
merged 5 commits into from
Dec 8, 2023
Merged

Show implied options in --showConfig #56701

merged 5 commits into from
Dec 8, 2023

Conversation

andrewbranch
Copy link
Member

Fixes my minor annoyance from earlier today

--showConfig on this tsconfig:

{
  "compilerOptions": {
    "module": "NodeNext"
  }
}

Before:

{
    "compilerOptions": {
        "module": "nodenext"
    },
    "files": [
        "./main.ts",
    ]
}

After:

{
    "compilerOptions": {
        "module": "nodenext",
        "target": "esnext",
        "moduleResolution": "nodenext",
        "moduleDetection": "force",
        "esModuleInterop": true,
        "allowSyntheticDefaultImports": true,
        "useDefineForClassFields": true
    },
    "files": [
        "./main.ts"
    ]
}

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 6, 2023
@andrewbranch
Copy link
Member Author

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Dec 6, 2023

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

Update: The results are in!

/** @internal */
export const getEmitModuleDetectionKind = computedOptions.moduleDetection.computeValue;
/** @internal */
export const getIsolatedModules = computedOptions.isolatedModules.computeValue;
Copy link
Member Author

Choose a reason for hiding this comment

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

One advantage is that these functions now automatically say what they depend on in their parameter type. The signature of this one, for example, is (compilerOptions: Pick<CompilerOptions, "isolatedModules" | "verbatimModuleSyntax">) => boolean

@typescript-bot
Copy link
Collaborator

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

Here they are:

Compiler

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Angular - node (v18.15.0, x64)
Memory used 295,352k (± 0.01%) 295,387k (± 0.01%) ~ 295,342k 295,437k p=0.149 n=6
Parse Time 2.65s (± 0.19%) 2.65s (± 0.52%) ~ 2.63s 2.67s p=0.794 n=6
Bind Time 0.82s (± 0.00%) 0.82s (± 0.50%) ~ 0.82s 0.83s p=0.405 n=6
Check Time 8.13s (± 0.23%) 8.12s (± 0.39%) ~ 8.09s 8.16s p=0.808 n=6
Emit Time 7.11s (± 0.46%) 7.09s (± 0.21%) ~ 7.08s 7.12s p=0.462 n=6
Total Time 18.70s (± 0.27%) 18.68s (± 0.22%) ~ 18.62s 18.73s p=0.469 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used 191,405k (± 0.02%) 192,344k (± 1.23%) ~ 191,356k 197,184k p=0.471 n=6
Parse Time 1.35s (± 0.81%) 1.36s (± 0.60%) ~ 1.35s 1.37s p=0.197 n=6
Bind Time 0.72s (± 0.00%) 0.72s (± 0.00%) ~ 0.72s 0.72s p=1.000 n=6
Check Time 9.26s (± 0.50%) 9.25s (± 0.44%) ~ 9.22s 9.33s p=0.935 n=6
Emit Time 2.61s (± 0.56%) 2.61s (± 0.39%) ~ 2.60s 2.63s p=1.000 n=6
Total Time 13.94s (± 0.42%) 13.94s (± 0.25%) ~ 13.90s 14.00s p=0.377 n=6
Monaco - node (v18.15.0, x64)
Memory used 347,355k (± 0.01%) 347,387k (± 0.01%) ~ 347,331k 347,422k p=0.093 n=6
Parse Time 2.46s (± 0.21%) 2.46s (± 0.48%) ~ 2.44s 2.47s p=0.666 n=6
Bind Time 0.92s (± 0.82%) 0.92s (± 0.56%) ~ 0.92s 0.93s p=0.784 n=6
Check Time 6.92s (± 0.38%) 6.91s (± 0.35%) ~ 6.88s 6.94s p=0.624 n=6
Emit Time 4.05s (± 0.29%) 4.05s (± 0.10%) ~ 4.04s 4.05s p=0.584 n=6
Total Time 14.35s (± 0.15%) 14.35s (± 0.23%) ~ 14.31s 14.39s p=0.686 n=6
TFS - node (v18.15.0, x64)
Memory used 302,655k (± 0.01%) 302,644k (± 0.01%) ~ 302,623k 302,694k p=0.199 n=6
Parse Time 2.00s (± 0.49%) 1.99s (± 1.47%) ~ 1.93s 2.01s p=0.933 n=6
Bind Time 1.00s (± 0.52%) 1.00s (± 0.52%) ~ 0.99s 1.00s p=1.000 n=6
Check Time 6.29s (± 0.37%) 6.28s (± 0.29%) ~ 6.26s 6.31s p=0.683 n=6
Emit Time 3.58s (± 0.52%) 3.58s (± 0.47%) ~ 3.56s 3.60s p=0.681 n=6
Total Time 12.86s (± 0.10%) 12.84s (± 0.33%) ~ 12.79s 12.91s p=0.460 n=6
material-ui - node (v18.15.0, x64)
Memory used 506,737k (± 0.01%) 506,776k (± 0.00%) +40k (+ 0.01%) 506,744k 506,804k p=0.045 n=6
Parse Time 2.57s (± 0.49%) 2.58s (± 0.47%) ~ 2.57s 2.60s p=0.102 n=6
Bind Time 0.98s (± 0.52%) 0.99s (± 1.48%) ~ 0.97s 1.01s p=0.276 n=6
Check Time 16.89s (± 0.56%) 16.86s (± 0.42%) ~ 16.78s 16.97s p=0.748 n=6
Emit Time 0.00s (± 0.00%) 0.00s (± 0.00%) ~ 0.00s 0.00s p=1.000 n=6
Total Time 20.45s (± 0.44%) 20.43s (± 0.34%) ~ 20.36s 20.52s p=0.872 n=6
xstate - node (v18.15.0, x64)
Memory used 512,754k (± 0.01%) 512,803k (± 0.01%) ~ 512,758k 512,840k p=0.229 n=6
Parse Time 3.28s (± 0.17%) 3.28s (± 0.16%) ~ 3.27s 3.28s p=0.640 n=6
Bind Time 1.54s (± 0.33%) 1.53s (± 0.27%) -0.01s (- 0.76%) 1.53s 1.54s p=0.007 n=6
Check Time 2.81s (± 0.29%) 2.81s (± 0.55%) ~ 2.80s 2.84s p=0.934 n=6
Emit Time 0.08s (± 6.19%) 0.08s (± 4.99%) ~ 0.08s 0.09s p=0.595 n=6
Total Time 7.70s (± 0.13%) 7.70s (± 0.11%) ~ 7.69s 7.71s p=0.867 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Angular - node (v18.15.0, x64)
  • Compiler-Unions - node (v18.15.0, x64)
  • Monaco - node (v18.15.0, x64)
  • TFS - node (v18.15.0, x64)
  • material-ui - node (v18.15.0, x64)
  • xstate - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

tsserver

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,347ms (± 0.72%) 2,340ms (± 0.39%) ~ 2,331ms 2,352ms p=0.378 n=6
Req 2 - geterr 5,384ms (± 1.38%) 5,387ms (± 1.33%) ~ 5,343ms 5,532ms p=0.936 n=6
Req 3 - references 323ms (± 1.50%) 326ms (± 1.85%) ~ 320ms 332ms p=0.461 n=6
Req 4 - navto 279ms (± 0.98%) 279ms (± 0.86%) ~ 274ms 280ms p=0.652 n=6
Req 5 - completionInfo count 1,356 (± 0.00%) 1,356 (± 0.00%) ~ 1,356 1,356 p=1.000 n=6
Req 5 - completionInfo 84ms (± 6.91%) 85ms (± 4.66%) ~ 82ms 92ms p=0.789 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,464ms (± 1.42%) 2,487ms (± 0.47%) ~ 2,468ms 2,500ms p=0.093 n=6
Req 2 - geterr 4,156ms (± 1.94%) 4,112ms (± 1.85%) ~ 4,048ms 4,210ms p=0.471 n=6
Req 3 - references 342ms (± 1.49%) 345ms (± 1.45%) ~ 335ms 348ms p=0.258 n=6
Req 4 - navto 286ms (± 1.03%) 288ms (± 1.22%) ~ 285ms 292ms p=0.391 n=6
Req 5 - completionInfo count 1,518 (± 0.00%) 1,518 (± 0.00%) ~ 1,518 1,518 p=1.000 n=6
Req 5 - completionInfo 82ms (± 7.74%) 85ms (± 7.32%) ~ 77ms 90ms p=0.511 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,604ms (± 0.96%) 2,597ms (± 0.76%) ~ 2,573ms 2,619ms p=0.628 n=6
Req 2 - geterr 1,692ms (± 2.07%) 1,687ms (± 2.61%) ~ 1,639ms 1,757ms p=0.936 n=6
Req 3 - references 110ms (± 6.91%) 117ms (± 9.38%) ~ 102ms 125ms p=0.169 n=6
Req 4 - navto 367ms (± 1.23%) 365ms (± 0.14%) ~ 364ms 365ms p=0.210 n=6
Req 5 - completionInfo count 2,073 (± 0.00%) 2,073 (± 0.00%) ~ 2,073 2,073 p=1.000 n=6
Req 5 - completionInfo 306ms (± 0.92%) 305ms (± 1.47%) ~ 300ms 311ms p=1.000 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • CompilerTSServer - node (v18.15.0, x64)
  • Compiler-UnionsTSServer - node (v18.15.0, x64)
  • xstateTSServer - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Startup

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
tsc-startup - node (v18.15.0, x64)
Execution time 152.93ms (± 0.21%) 153.07ms (± 0.19%) +0.13ms (+ 0.09%) 152.02ms 156.81ms p=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 228.09ms (± 0.18%) 228.10ms (± 0.15%) ~ 226.85ms 231.71ms p=0.271 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 229.53ms (± 0.19%) 229.63ms (± 0.19%) +0.10ms (+ 0.04%) 227.77ms 237.07ms p=0.012 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 229.39ms (± 0.19%) 229.58ms (± 0.17%) +0.19ms (+ 0.08%) 227.92ms 232.06ms p=0.000 n=600
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • tsc-startup - node (v18.15.0, x64)
  • tsserver-startup - node (v18.15.0, x64)
  • tsserverlibrary-startup - node (v18.15.0, x64)
  • typescript-startup - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

Copy link
Member

@jakebailey jakebailey left a comment

Choose a reason for hiding this comment

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

This seems reasonable to me.

I know the perf doesn't seem to be affected, but I do wonder if we should lift all of these calls in the checker upward so they're all precalculated and local, rather than continually calculating them. e.g. we call getEmitModuleResolutionKind and getESModuleInterop a looot. As evidenced by this change, they all strictly depend on compilerOptions, so could be known immediately.

src/compiler/utilities.ts Outdated Show resolved Hide resolved
moduleResolution: computedCompilerOption("moduleResolution", ["module", "target"], (compilerOptions): ModuleResolutionKind => {
let moduleResolution = compilerOptions.moduleResolution;
if (moduleResolution === undefined) {
export const computedOptions = createComputedCompilerOptions({
Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks @Andarist for helping with this tricky inference 🌟

This only works in recent nightlies, hence the “LKG” bump (cc @jakebailey)

Copy link
Member

Choose a reason for hiding this comment

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

I don't mind bumping the TS version, though I am wondering which PR was needed to make this pattern work (and of course if there's any change at all that we could avoid it 😅).

But yeah, this pattern is nicer than the previous IMO.

Copy link
Contributor

Choose a reason for hiding this comment

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

It’s the recent improvement from #55811 . It was merged in just last week :)

package.json Outdated Show resolved Hide resolved
src/compiler/utilities.ts Outdated Show resolved Hide resolved
src/compiler/utilities.ts Outdated Show resolved Hide resolved
Copy link
Member

@sheetalkamat sheetalkamat left a comment

Choose a reason for hiding this comment

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

Looks good apart from minor nits

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.

5 participants