Skip to content

Show implied options in --showConfig - #56701

Merged
Andrew Branch (andrewbranch) merged 5 commits into
mainfrom
better-show-config
Dec 8, 2023
Merged

Show implied options in --showConfig#56701
Andrew Branch (andrewbranch) merged 5 commits into
mainfrom
better-show-config

Conversation

@andrewbranch

Copy link
Copy Markdown
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"
]
}

@andrewbranch

Copy link
Copy Markdown
MemberAuthor

TypeScript Bot (@typescript-bot) perf test this

@typescript-bot

TypeScript Bot (typescript-bot) commented Dec 6, 2023

Copy link
Copy Markdown
Contributor

Heya Andrew Branch (@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
Copy Markdown
MemberAuthor

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
Copy Markdown
Contributor

Andrew Branch (@andrewbranch)
The results of the perf run you requested are in!

Here they are:

Compiler

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Angular - node (v18.15.0, x64)
Memory used295,352k (± 0.01%)295,387k (± 0.01%)~295,342k295,437kp=0.149 n=6
Parse Time2.65s (± 0.19%)2.65s (± 0.52%)~2.63s2.67sp=0.794 n=6
Bind Time0.82s (± 0.00%)0.82s (± 0.50%)~0.82s0.83sp=0.405 n=6
Check Time8.13s (± 0.23%)8.12s (± 0.39%)~8.09s8.16sp=0.808 n=6
Emit Time7.11s (± 0.46%)7.09s (± 0.21%)~7.08s7.12sp=0.462 n=6
Total Time18.70s (± 0.27%)18.68s (± 0.22%)~18.62s18.73sp=0.469 n=6
Compiler-Unions - node (v18.15.0, x64)
Memory used191,405k (± 0.02%)192,344k (± 1.23%)~191,356k197,184kp=0.471 n=6
Parse Time1.35s (± 0.81%)1.36s (± 0.60%)~1.35s1.37sp=0.197 n=6
Bind Time0.72s (± 0.00%)0.72s (± 0.00%)~0.72s0.72sp=1.000 n=6
Check Time9.26s (± 0.50%)9.25s (± 0.44%)~9.22s9.33sp=0.935 n=6
Emit Time2.61s (± 0.56%)2.61s (± 0.39%)~2.60s2.63sp=1.000 n=6
Total Time13.94s (± 0.42%)13.94s (± 0.25%)~13.90s14.00sp=0.377 n=6
Monaco - node (v18.15.0, x64)
Memory used347,355k (± 0.01%)347,387k (± 0.01%)~347,331k347,422kp=0.093 n=6
Parse Time2.46s (± 0.21%)2.46s (± 0.48%)~2.44s2.47sp=0.666 n=6
Bind Time0.92s (± 0.82%)0.92s (± 0.56%)~0.92s0.93sp=0.784 n=6
Check Time6.92s (± 0.38%)6.91s (± 0.35%)~6.88s6.94sp=0.624 n=6
Emit Time4.05s (± 0.29%)4.05s (± 0.10%)~4.04s4.05sp=0.584 n=6
Total Time14.35s (± 0.15%)14.35s (± 0.23%)~14.31s14.39sp=0.686 n=6
TFS - node (v18.15.0, x64)
Memory used302,655k (± 0.01%)302,644k (± 0.01%)~302,623k302,694kp=0.199 n=6
Parse Time2.00s (± 0.49%)1.99s (± 1.47%)~1.93s2.01sp=0.933 n=6
Bind Time1.00s (± 0.52%)1.00s (± 0.52%)~0.99s1.00sp=1.000 n=6
Check Time6.29s (± 0.37%)6.28s (± 0.29%)~6.26s6.31sp=0.683 n=6
Emit Time3.58s (± 0.52%)3.58s (± 0.47%)~3.56s3.60sp=0.681 n=6
Total Time12.86s (± 0.10%)12.84s (± 0.33%)~12.79s12.91sp=0.460 n=6
material-ui - node (v18.15.0, x64)
Memory used506,737k (± 0.01%)506,776k (± 0.00%)+40k (+ 0.01%)506,744k506,804kp=0.045 n=6
Parse Time2.57s (± 0.49%)2.58s (± 0.47%)~2.57s2.60sp=0.102 n=6
Bind Time0.98s (± 0.52%)0.99s (± 1.48%)~0.97s1.01sp=0.276 n=6
Check Time16.89s (± 0.56%)16.86s (± 0.42%)~16.78s16.97sp=0.748 n=6
Emit Time0.00s (± 0.00%)0.00s (± 0.00%)~0.00s0.00sp=1.000 n=6
Total Time20.45s (± 0.44%)20.43s (± 0.34%)~20.36s20.52sp=0.872 n=6
xstate - node (v18.15.0, x64)
Memory used512,754k (± 0.01%)512,803k (± 0.01%)~512,758k512,840kp=0.229 n=6
Parse Time3.28s (± 0.17%)3.28s (± 0.16%)~3.27s3.28sp=0.640 n=6
Bind Time1.54s (± 0.33%)1.53s (± 0.27%)-0.01s (- 0.76%)1.53s1.54sp=0.007 n=6
Check Time2.81s (± 0.29%)2.81s (± 0.55%)~2.80s2.84sp=0.934 n=6
Emit Time0.08s (± 6.19%)0.08s (± 4.99%)~0.08s0.09sp=0.595 n=6
Total Time7.70s (± 0.13%)7.70s (± 0.11%)~7.69s7.71sp=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)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

tsserver

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
Compiler-UnionsTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,347ms (± 0.72%)2,340ms (± 0.39%)~2,331ms2,352msp=0.378 n=6
Req 2 - geterr5,384ms (± 1.38%)5,387ms (± 1.33%)~5,343ms5,532msp=0.936 n=6
Req 3 - references323ms (± 1.50%)326ms (± 1.85%)~320ms332msp=0.461 n=6
Req 4 - navto279ms (± 0.98%)279ms (± 0.86%)~274ms280msp=0.652 n=6
Req 5 - completionInfo count1,356 (± 0.00%)1,356 (± 0.00%)~1,3561,356p=1.000 n=6
Req 5 - completionInfo84ms (± 6.91%)85ms (± 4.66%)~82ms92msp=0.789 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,464ms (± 1.42%)2,487ms (± 0.47%)~2,468ms2,500msp=0.093 n=6
Req 2 - geterr4,156ms (± 1.94%)4,112ms (± 1.85%)~4,048ms4,210msp=0.471 n=6
Req 3 - references342ms (± 1.49%)345ms (± 1.45%)~335ms348msp=0.258 n=6
Req 4 - navto286ms (± 1.03%)288ms (± 1.22%)~285ms292msp=0.391 n=6
Req 5 - completionInfo count1,518 (± 0.00%)1,518 (± 0.00%)~1,5181,518p=1.000 n=6
Req 5 - completionInfo82ms (± 7.74%)85ms (± 7.32%)~77ms90msp=0.511 n=6
xstateTSServer - node (v18.15.0, x64)
Req 1 - updateOpen2,604ms (± 0.96%)2,597ms (± 0.76%)~2,573ms2,619msp=0.628 n=6
Req 2 - geterr1,692ms (± 2.07%)1,687ms (± 2.61%)~1,639ms1,757msp=0.936 n=6
Req 3 - references110ms (± 6.91%)117ms (± 9.38%)~102ms125msp=0.169 n=6
Req 4 - navto367ms (± 1.23%)365ms (± 0.14%)~364ms365msp=0.210 n=6
Req 5 - completionInfo count2,073 (± 0.00%)2,073 (± 0.00%)~2,0732,073p=1.000 n=6
Req 5 - completionInfo306ms (± 0.92%)305ms (± 1.47%)~300ms311msp=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)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Startup

Comparison Report - baseline..pr
MetricbaselineprDeltaBestWorstp-value
tsc-startup - node (v18.15.0, x64)
Execution time152.93ms (± 0.21%)153.07ms (± 0.19%)+0.13ms (+ 0.09%)152.02ms156.81msp=0.000 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time228.09ms (± 0.18%)228.10ms (± 0.15%)~226.85ms231.71msp=0.271 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time229.53ms (± 0.19%)229.63ms (± 0.19%)+0.10ms (+ 0.04%)227.77ms237.07msp=0.012 n=600
typescript-startup - node (v18.15.0, x64)
Execution time229.39ms (± 0.19%)229.58ms (± 0.17%)+0.19ms (+ 0.08%)227.92ms232.06msp=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)
BenchmarkNameIterations
Currentpr6
Baselinebaseline6

Developer Information:

Download Benchmarks

@jakebaileyJake Bailey (jakebailey) left a comment

Copy link
Copy Markdown
Member

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.

Comment threadsrc/compiler/utilities.ts Outdated
moduleResolution: computedCompilerOption("moduleResolution", ["module", "target"], (compilerOptions): ModuleResolutionKind => {
let moduleResolution = compilerOptions.moduleResolution;
if (moduleResolution === undefined) {
export const computedOptions = createComputedCompilerOptions({

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

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

Thanks Mateusz Burzyński (@Andarist) for helping with this tricky inference 🌟

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

Copy link
Copy Markdown
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
Copy Markdown
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 :)

Comment threadpackage.json Outdated
Comment threadsrc/compiler/utilities.ts Outdated
Comment threadsrc/compiler/utilities.ts Outdated
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts
Comment threadsrc/compiler/utilities.ts

Copy link
Copy Markdown
Member

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 freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Author: TeamFor Uncommitted BugPR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@andrewbranch@typescript-bot@jakebailey@sheetalkamat@Andarist