Skip to content

Fix flow node improper reuse #60662

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

Merged
merged 2 commits into from
Dec 4, 2024
Merged

Fix flow node improper reuse #60662

merged 2 commits into from
Dec 4, 2024

Conversation

gabritto
Copy link
Member

@gabritto gabritto commented Dec 3, 2024

Fixes #60597.

The problem is caused by improper handling of node reuse across different versions of a source file. Say we have the following program:

function test() {
    returnabc();
    return;
}
function abc() { }

We'll get a compiler error saying returnabc could not be found. And, when we bind the source file, return will have its flow node set to a flow call node (corresponding to returnabc()).
If we then edit the file to this:

function test() {
    return abc();
    return;
}
function abc() { }

We will reuse the node for return. However, because that node is unreachable, the binder will not assign a new flow node to that node, and it will preserve its old flow node. Now, when we check the source file, we expect it to have no errors, but the return node will have a flow node for the old file, and that flow node will have a node that corresponds to the returnabc() call, and the checker will error on it when it visits that node.

What this PR does is clean up the old flow node in the binder when a node is unreachable, because otherwise the flow node would not be updated.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Dec 3, 2024
Comment on lines 1107 to 1109
if ((node as HasFlowNode).flowNode) {
(node as HasFlowNode).flowNode = undefined;
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if ((node as HasFlowNode).flowNode) {
(node as HasFlowNode).flowNode = undefined;
}
if (canHaveFlowNode(node)) {
node.flowNode = undefined;
}

To avoid casting, but also because I think it'll prevent negative perf effects from speculatively trying to access flowNode on all nodes?

Then again, the binder does not currently import this function at all, and it's not used below where flowNode is set, so maybe not.

Copy link
Contributor

Choose a reason for hiding this comment

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

Calling canHaveFlowNode is better than the cast as it accesses a property that is always present (kind), vs. a property that may not be defined (flowNode). The latter results in eager deoptimizations as a result of the missing property.

@gabritto
Copy link
Member Author

gabritto commented Dec 3, 2024

@typescript-bot perf test this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Dec 3, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
perf test this ✅ Started 👀 Results

@gabritto
Copy link
Member Author

gabritto commented Dec 3, 2024

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Dec 3, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,363 62,363 ~ ~ ~ p=1.000 n=6
Types 50,395 50,395 ~ ~ ~ p=1.000 n=6
Memory used 196,181k (± 0.72%) 196,123k (± 0.83%) ~ 192,797k 196,842k p=0.936 n=6
Parse Time 1.62s (± 1.20%) 1.58s (± 1.94%) -0.04s (- 2.36%) 1.54s 1.63s p=0.036 n=6
Bind Time 0.87s (± 1.40%) 0.86s (± 1.47%) ~ 0.84s 0.87s p=0.458 n=6
Check Time 11.75s (± 0.36%) 11.76s (± 0.43%) ~ 11.69s 11.81s p=0.809 n=6
Emit Time 3.36s (± 3.03%) 3.35s (± 3.22%) ~ 3.26s 3.56s p=0.570 n=6
Total Time 17.59s (± 0.60%) 17.55s (± 0.88%) ~ 17.44s 17.84s p=0.336 n=6
angular-1 - node (v18.15.0, x64)
Errors 37 37 ~ ~ ~ p=1.000 n=6
Symbols 947,936 947,936 ~ ~ ~ p=1.000 n=6
Types 410,955 410,955 ~ ~ ~ p=1.000 n=6
Memory used 1,226,247k (± 0.01%) 1,226,173k (± 0.00%) ~ 1,226,143k 1,226,216k p=0.128 n=6
Parse Time 8.10s (± 0.96%) 8.13s (± 0.40%) ~ 8.09s 8.17s p=0.521 n=6
Bind Time 2.29s (± 1.18%) 2.29s (± 0.77%) ~ 2.27s 2.31s p=1.000 n=6
Check Time 38.33s (± 0.25%) 38.22s (± 0.47%) ~ 37.93s 38.48s p=0.199 n=6
Emit Time 18.35s (± 0.76%) 18.28s (± 1.09%) ~ 17.94s 18.52s p=0.630 n=6
Total Time 67.07s (± 0.29%) 66.92s (± 0.30%) ~ 66.55s 67.11s p=0.377 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,501,812 2,501,812 ~ ~ ~ p=1.000 n=6
Types 909,643 909,643 ~ ~ ~ p=1.000 n=6
Memory used 2,319,376k (± 0.00%) 2,319,473k (± 0.00%) ~ 2,319,367k 2,319,600k p=0.230 n=6
Parse Time 11.25s (± 0.40%) 11.20s (± 0.17%) ~ 11.17s 11.22s p=0.126 n=6
Bind Time 2.61s (± 0.67%) 2.63s (± 0.85%) ~ 2.60s 2.66s p=0.368 n=6
Check Time 90.60s (± 2.15%) 90.77s (± 1.90%) ~ 89.09s 92.69s p=0.689 n=6
Emit Time 0.35s (± 2.92%) 0.35s (± 2.42%) ~ 0.33s 0.35s p=0.210 n=6
Total Time 104.81s (± 1.82%) 104.94s (± 1.64%) ~ 103.25s 106.85s p=0.689 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,250 1,225,250 ~ ~ ~ p=1.000 n=6
Types 266,546 266,546 ~ ~ ~ p=1.000 n=6
Memory used 2,962,847k (±10.02%) 2,842,118k (±13.22%) ~ 2,355,938k 3,085,962k p=0.810 n=6
Parse Time 6.80s (± 1.06%) 6.77s (± 1.71%) ~ 6.62s 6.87s p=0.936 n=6
Bind Time 2.15s (± 0.76%) 2.14s (± 1.93%) ~ 2.09s 2.19s p=1.000 n=6
Check Time 42.84s (± 0.38%) 42.75s (± 0.46%) ~ 42.48s 43.06s p=0.471 n=6
Emit Time 3.47s (± 2.35%) 3.51s (± 3.15%) ~ 3.39s 3.68s p=0.521 n=6
Total Time 55.25s (± 0.35%) 55.15s (± 0.47%) ~ 54.70s 55.44s p=0.810 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,250 1,225,250 ~ ~ ~ p=1.000 n=6
Types 266,546 266,546 ~ ~ ~ p=1.000 n=6
Memory used 3,029,332k (± 9.76%) 3,028,704k (± 9.76%) ~ 2,424,390k 3,150,325k p=0.471 n=6
Parse Time 7.00s (± 1.07%) 7.00s (± 1.50%) ~ 6.80s 7.09s p=0.689 n=6
Bind Time 2.13s (± 1.79%) 2.12s (± 1.62%) ~ 2.10s 2.19s p=0.871 n=6
Check Time 42.89s (± 0.36%) 42.82s (± 0.63%) ~ 42.30s 43.06s p=0.936 n=6
Emit Time 3.45s (± 2.40%) 3.46s (± 2.68%) ~ 3.37s 3.63s p=1.000 n=6
Total Time 55.49s (± 0.40%) 55.42s (± 0.65%) ~ 54.70s 55.66s p=0.810 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,222 262,222 ~ ~ ~ p=1.000 n=6
Types 106,607 106,607 ~ ~ ~ p=1.000 n=6
Memory used 439,799k (± 0.01%) 439,797k (± 0.01%) ~ 439,736k 439,901k p=0.471 n=6
Parse Time 3.51s (± 0.77%) 3.55s (± 0.73%) +0.04s (+ 1.09%) 3.52s 3.58s p=0.043 n=6
Bind Time 1.31s (± 0.89%) 1.32s (± 0.39%) ~ 1.31s 1.32s p=0.351 n=6
Check Time 18.89s (± 0.20%) 18.92s (± 0.36%) ~ 18.84s 19.00s p=0.572 n=6
Emit Time 1.52s (± 1.58%) 1.53s (± 1.48%) ~ 1.49s 1.56s p=0.746 n=6
Total Time 25.23s (± 0.19%) 25.31s (± 0.25%) +0.08s (+ 0.31%) 25.24s 25.39s p=0.042 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 70 70 ~ ~ ~ p=1.000 n=6
Symbols 226,062 226,062 ~ ~ ~ p=1.000 n=6
Types 94,488 94,488 ~ ~ ~ p=1.000 n=6
Memory used 371,584k (± 0.02%) 371,629k (± 0.03%) ~ 371,557k 371,882k p=0.468 n=6
Parse Time 2.89s (± 1.24%) 2.91s (± 0.60%) ~ 2.89s 2.94s p=0.421 n=6
Bind Time 1.58s (± 0.53%) 1.59s (± 1.62%) ~ 1.57s 1.64s p=0.732 n=6
Check Time 16.48s (± 0.50%) 16.48s (± 0.32%) ~ 16.40s 16.53s p=1.000 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.96s (± 0.37%) 20.98s (± 0.37%) ~ 20.87s 21.07s p=0.520 n=6
vscode - node (v18.15.0, x64)
Errors 3 3 ~ ~ ~ p=1.000 n=6
Symbols 3,194,807 3,194,807 ~ ~ ~ p=1.000 n=6
Types 1,098,503 1,098,503 ~ ~ ~ p=1.000 n=6
Memory used 3,268,962k (± 0.01%) 3,268,752k (± 0.01%) ~ 3,268,470k 3,269,245k p=0.378 n=6
Parse Time 11.55s (± 0.36%) 11.52s (± 0.23%) ~ 11.50s 11.57s p=0.325 n=6
Bind Time 3.77s (± 0.36%) 3.81s (± 2.38%) ~ 3.75s 3.99s p=0.801 n=6
Check Time 73.06s (± 0.40%) 73.22s (± 0.30%) ~ 73.01s 73.61s p=0.423 n=6
Emit Time 23.33s (± 1.77%) 23.55s (± 1.48%) ~ 23.07s 23.86s p=0.229 n=6
Total Time 111.71s (± 0.22%) 112.09s (± 0.26%) +0.38s (+ 0.34%) 111.69s 112.60s p=0.031 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 288,743 288,743 ~ ~ ~ p=1.000 n=6
Types 117,156 117,156 ~ ~ ~ p=1.000 n=6
Memory used 441,069k (± 0.03%) 440,951k (± 0.02%) ~ 440,847k 441,118k p=0.066 n=6
Parse Time 4.09s (± 0.56%) 4.09s (± 0.72%) ~ 4.04s 4.12s p=1.000 n=6
Bind Time 1.75s (± 1.93%) 1.74s (± 1.07%) ~ 1.70s 1.75s p=0.453 n=6
Check Time 18.89s (± 0.65%) 18.82s (± 0.62%) ~ 18.66s 18.97s p=0.377 n=6
Emit Time 0.00s (±244.70%) 0.00s (±244.70%) ~ 0.00s 0.01s p=1.000 n=6
Total Time 24.73s (± 0.56%) 24.64s (± 0.59%) ~ 24.45s 24.82s p=0.470 n=6
xstate-main - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 552,390 552,390 ~ ~ ~ p=1.000 n=6
Types 185,096 185,096 ~ ~ ~ p=1.000 n=6
Memory used 492,494k (± 0.01%) 492,499k (± 0.01%) ~ 492,467k 492,538k p=0.936 n=6
Parse Time 3.40s (± 0.63%) 3.42s (± 0.89%) ~ 3.40s 3.48s p=0.416 n=6
Bind Time 1.16s (± 1.60%) 1.17s (± 1.03%) ~ 1.16s 1.19s p=0.324 n=6
Check Time 19.48s (± 0.44%) 19.43s (± 0.40%) ~ 19.33s 19.53s p=0.423 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.05s (± 0.34%) 24.03s (± 0.38%) ~ 23.92s 24.18s p=0.873 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - 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,309ms (± 0.39%) 2,305ms (± 1.14%) ~ 2,258ms 2,331ms p=0.873 n=6
Req 2 - geterr 5,313ms (± 0.50%) 5,305ms (± 0.40%) ~ 5,270ms 5,333ms p=0.575 n=6
Req 3 - references 263ms (± 2.09%) 264ms (± 1.96%) ~ 259ms 269ms p=0.742 n=6
Req 4 - navto 227ms (± 0.59%) 227ms (± 0.59%) ~ 225ms 228ms p=1.000 n=6
Req 5 - completionInfo count 1,357 1,357 ~ ~ ~ p=1.000 n=6
Req 5 - completionInfo 78ms (± 3.56%) 78ms (± 3.29%) ~ 76ms 81ms p=0.865 n=6
CompilerTSServer - node (v18.15.0, x64)
Req 1 - updateOpen 2,438ms (± 0.79%) 2,429ms (± 1.04%) ~ 2,403ms 2,462ms p=0.873 n=6
Req 2 - geterr 4,015ms (± 0.26%) 4,024ms (± 0.64%) ~ 4,003ms 4,065ms p=1.000 n=6
Req 3 - references 281ms (± 0.39%) 280ms (± 1.04%) ~ 274ms 282ms p=0.863 n=6
Req 4 - navto 228ms (± 0.72%) 227ms (± 0.28%) ~ 226ms 228ms p=0.599 n=6
Req 5 - completionInfo count 1,519 1,519 ~ ~ ~ p=1.000 n=6
Req 5 - completionInfo 85ms (± 3.24%) 83ms (± 5.33%) ~ 75ms 87ms p=0.565 n=6
xstate-main-1-tsserver - node (v18.15.0, x64)
Req 1 - updateOpen 5,286ms (± 0.23%) 5,287ms (± 0.23%) ~ 5,269ms 5,304ms p=0.872 n=6
Req 2 - geterr 1,145ms (± 1.04%) 1,153ms (± 1.06%) ~ 1,137ms 1,167ms p=0.298 n=6
Req 3 - references 82ms (± 3.93%) 82ms (± 0.63%) ~ 82ms 83ms p=0.533 n=6
Req 4 - navto 450ms (± 0.34%) 448ms (± 0.63%) ~ 442ms 450ms p=0.076 n=6
Req 5 - completionInfo count 3,450 3,450 ~ ~ ~ p=1.000 n=6
Req 5 - completionInfo 840ms (± 1.58%) 831ms (± 0.70%) ~ 824ms 840ms p=0.172 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)
  • xstate-main-1-tsserver - 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 159.32ms (± 0.23%) 159.40ms (± 0.24%) +0.08ms (+ 0.05%) 158.12ms 165.29ms p=0.009 n=600
tsserver-startup - node (v18.15.0, x64)
Execution time 233.09ms (± 0.16%) 232.98ms (± 0.16%) -0.11ms (- 0.05%) 231.72ms 238.61ms p=0.010 n=600
tsserverlibrary-startup - node (v18.15.0, x64)
Execution time 229.40ms (± 0.16%) 229.36ms (± 0.17%) ~ 227.83ms 238.95ms p=0.151 n=600
typescript-startup - node (v18.15.0, x64)
Execution time 229.19ms (± 0.17%) 229.21ms (± 0.15%) ~ 227.83ms 234.20ms p=0.599 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

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,363 62,363 ~ ~ ~ p=1.000 n=6
Types 50,395 50,395 ~ ~ ~ p=1.000 n=6
Memory used 196,743k (± 0.06%) 196,714k (± 0.06%) ~ 196,473k 196,827k p=0.810 n=6
Parse Time 1.58s (± 1.53%) 1.61s (± 0.47%) +0.03s (+ 1.79%) 1.60s 1.62s p=0.021 n=6
Bind Time 0.87s (± 2.05%) 0.87s (± 1.13%) ~ 0.86s 0.88s p=0.935 n=6
Check Time 11.82s (± 0.49%) 11.84s (± 0.25%) ~ 11.79s 11.87s p=0.688 n=6
Emit Time 3.35s (± 3.06%) 3.34s (± 4.31%) ~ 3.23s 3.61s p=0.574 n=6
Total Time 17.63s (± 0.74%) 17.66s (± 0.92%) ~ 17.52s 17.97s p=0.809 n=6
angular-1 - node (v18.15.0, x64)
Errors 37 37 ~ ~ ~ p=1.000 n=6
Symbols 947,936 947,936 ~ ~ ~ p=1.000 n=6
Types 410,955 410,955 ~ ~ ~ p=1.000 n=6
Memory used 1,226,022k (± 0.00%) 1,225,992k (± 0.01%) ~ 1,225,875k 1,226,051k p=0.471 n=6
Parse Time 6.62s (± 0.60%) 6.63s (± 0.46%) ~ 6.58s 6.67s p=0.466 n=6
Bind Time 1.89s (± 0.43%) 1.89s (± 0.40%) ~ 1.88s 1.90s p=0.729 n=6
Check Time 31.90s (± 0.41%) 32.00s (± 0.28%) ~ 31.86s 32.09s p=0.126 n=6
Emit Time 15.17s (± 0.31%) 15.20s (± 0.31%) ~ 15.13s 15.26s p=0.375 n=6
Total Time 55.57s (± 0.27%) 55.71s (± 0.15%) ~ 55.62s 55.83s p=0.092 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,501,812 2,501,812 ~ ~ ~ p=1.000 n=6
Types 909,643 909,643 ~ ~ ~ p=1.000 n=6
Memory used 2,319,238k (± 0.00%) 2,319,242k (± 0.00%) ~ 2,319,139k 2,319,310k p=0.810 n=6
Parse Time 9.28s (± 0.29%) 9.29s (± 0.36%) ~ 9.27s 9.36s p=0.685 n=6
Bind Time 2.17s (± 0.64%) 2.17s (± 0.70%) ~ 2.14s 2.18s p=0.868 n=6
Check Time 75.05s (± 1.49%) 74.92s (± 0.36%) ~ 74.50s 75.20s p=0.336 n=6
Emit Time 0.29s (± 2.61%) 0.28s (± 2.67%) ~ 0.27s 0.29s p=0.195 n=6
Total Time 86.79s (± 1.30%) 86.66s (± 0.32%) ~ 86.24s 86.96s p=0.470 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,250 1,225,251 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 266,546 266,546 ~ ~ ~ p=1.000 n=6
Memory used 2,475,395k (±12.00%) 2,353,818k (± 0.02%) ~ 2,353,041k 2,354,254k p=0.173 n=6
Parse Time 5.25s (± 1.56%) 5.25s (± 0.24%) ~ 5.24s 5.27s p=0.575 n=6
Bind Time 1.77s (± 1.54%) 1.77s (± 1.15%) ~ 1.74s 1.80s p=0.872 n=6
Check Time 35.26s (± 0.24%) 35.25s (± 0.31%) ~ 35.04s 35.33s p=0.688 n=6
Emit Time 3.01s (± 0.98%) 2.97s (± 1.17%) ~ 2.94s 3.03s p=0.107 n=6
Total Time 45.29s (± 0.29%) 45.23s (± 0.25%) ~ 45.03s 45.33s p=0.936 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,250 1,225,251 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 266,546 266,546 ~ ~ ~ p=1.000 n=6
Memory used 3,028,977k (± 9.77%) 2,908,197k (±12.88%) ~ 2,423,651k 3,151,257k p=0.936 n=6
Parse Time 6.99s (± 1.60%) 6.92s (± 1.57%) ~ 6.77s 7.02s p=0.173 n=6
Bind Time 2.13s (± 1.21%) 2.16s (± 1.84%) ~ 2.12s 2.23s p=0.261 n=6
Check Time 42.69s (± 0.40%) 42.75s (± 0.40%) ~ 42.47s 42.93s p=0.378 n=6
Emit Time 3.46s (± 1.91%) 3.47s (± 2.22%) ~ 3.36s 3.55s p=1.000 n=6
Total Time 55.26s (± 0.49%) 55.29s (± 0.43%) ~ 54.91s 55.63s p=0.936 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,222 262,223 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 106,607 106,607 ~ ~ ~ p=1.000 n=6
Memory used 439,869k (± 0.03%) 439,859k (± 0.01%) ~ 439,787k 439,903k p=0.936 n=6
Parse Time 3.56s (± 0.79%) 3.54s (± 0.92%) ~ 3.48s 3.56s p=0.331 n=6
Bind Time 1.32s (± 0.62%) 1.31s (± 0.48%) ~ 1.30s 1.32s p=0.177 n=6
Check Time 18.90s (± 0.37%) 18.99s (± 0.52%) ~ 18.91s 19.18s p=0.147 n=6
Emit Time 1.53s (± 1.09%) 1.53s (± 0.79%) ~ 1.51s 1.54s p=0.934 n=6
Total Time 25.31s (± 0.23%) 25.35s (± 0.40%) ~ 25.27s 25.55s p=0.686 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 70 70 ~ ~ ~ p=1.000 n=6
Symbols 226,062 226,062 ~ ~ ~ p=1.000 n=6
Types 94,488 94,488 ~ ~ ~ p=1.000 n=6
Memory used 371,638k (± 0.02%) 371,646k (± 0.02%) ~ 371,531k 371,794k p=0.810 n=6
Parse Time 2.89s (± 0.87%) 2.90s (± 1.44%) ~ 2.84s 2.95s p=0.809 n=6
Bind Time 1.59s (± 1.41%) 1.60s (± 1.61%) ~ 1.56s 1.63s p=0.517 n=6
Check Time 16.52s (± 0.39%) 16.48s (± 0.37%) ~ 16.41s 16.58s p=0.228 n=6
Emit Time 0.00s (±154.76%) 0.00s ~ ~ ~ p=0.174 n=6
Total Time 21.01s (± 0.25%) 20.98s (± 0.37%) ~ 20.90s 21.10s p=0.422 n=6
vscode - node (v18.15.0, x64)
Errors 3 3 ~ ~ ~ p=1.000 n=6
Symbols 3,194,807 3,194,807 ~ ~ ~ p=1.000 n=6
Types 1,098,503 1,098,503 ~ ~ ~ p=1.000 n=6
Memory used 3,269,051k (± 0.01%) 3,269,465k (± 0.01%) ~ 3,268,993k 3,269,966k p=0.093 n=6
Parse Time 14.03s (± 0.55%) 14.00s (± 0.56%) ~ 13.90s 14.10s p=0.689 n=6
Bind Time 4.48s (± 0.38%) 4.48s (± 0.52%) ~ 4.44s 4.51s p=0.806 n=6
Check Time 85.84s (± 0.22%) 87.30s (± 2.02%) +1.45s (+ 1.69%) 85.96s 90.05s p=0.031 n=6
Emit Time 27.88s (± 1.81%) 27.08s (± 8.09%) ~ 22.87s 28.94s p=0.810 n=6
Total Time 132.23s (± 0.42%) 132.86s (± 1.00%) ~ 131.48s 135.05s p=0.575 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 288,743 288,743 ~ ~ ~ p=1.000 n=6
Types 117,156 117,156 ~ ~ ~ p=1.000 n=6
Memory used 441,064k (± 0.04%) 440,874k (± 0.04%) ~ 440,737k 441,111k p=0.230 n=6
Parse Time 4.10s (± 1.14%) 4.09s (± 0.89%) ~ 4.03s 4.13s p=0.808 n=6
Bind Time 1.74s (± 2.21%) 1.76s (± 1.54%) ~ 1.72s 1.80s p=0.414 n=6
Check Time 18.91s (± 0.66%) 18.84s (± 0.69%) ~ 18.67s 19.04s p=0.471 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.76s (± 0.64%) 24.69s (± 0.65%) ~ 24.50s 24.94s p=0.575 n=6
xstate-main - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 552,390 552,390 ~ ~ ~ p=1.000 n=6
Types 185,096 185,096 ~ ~ ~ p=1.000 n=6
Memory used 492,492k (± 0.02%) 492,481k (± 0.01%) ~ 492,428k 492,563k p=0.936 n=6
Parse Time 3.43s (± 1.02%) 3.42s (± 0.71%) ~ 3.39s 3.46s p=0.368 n=6
Bind Time 1.19s (± 1.02%) 1.18s (± 1.15%) ~ 1.16s 1.20s p=0.804 n=6
Check Time 19.46s (± 0.39%) 19.55s (± 0.32%) ~ 19.47s 19.65s p=0.053 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.08s (± 0.32%) 24.14s (± 0.33%) ~ 24.05s 24.27s p=0.261 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@gabritto
Copy link
Member Author

gabritto commented Dec 3, 2024

@typescript-bot perf test this faster

@typescript-bot
Copy link
Collaborator

typescript-bot commented Dec 3, 2024

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
perf test this faster ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

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

Here they are:

tsc

Comparison Report - baseline..pr
Metric baseline pr Delta Best Worst p-value
Compiler-Unions - node (v18.15.0, x64)
Errors 34 34 ~ ~ ~ p=1.000 n=6
Symbols 62,363 62,363 ~ ~ ~ p=1.000 n=6
Types 50,395 50,395 ~ ~ ~ p=1.000 n=6
Memory used 194,956k (± 1.03%) 196,140k (± 0.73%) ~ 193,237k 196,813k p=0.471 n=6
Parse Time 1.59s (± 1.75%) 1.61s (± 1.28%) ~ 1.57s 1.63s p=0.373 n=6
Bind Time 0.87s (± 1.84%) 0.87s (± 1.34%) ~ 0.85s 0.88s p=0.805 n=6
Check Time 11.76s (± 0.91%) 11.81s (± 0.93%) ~ 11.72s 12.01s p=0.689 n=6
Emit Time 3.35s (± 3.60%) 3.32s (± 3.00%) ~ 3.25s 3.52s p=0.574 n=6
Total Time 17.58s (± 0.72%) 17.61s (± 0.81%) ~ 17.45s 17.79s p=0.936 n=6
angular-1 - node (v18.15.0, x64)
Errors 37 37 ~ ~ ~ p=1.000 n=6
Symbols 947,936 947,936 ~ ~ ~ p=1.000 n=6
Types 410,955 410,955 ~ ~ ~ p=1.000 n=6
Memory used 1,226,023k (± 0.00%) 1,226,006k (± 0.01%) ~ 1,225,956k 1,226,111k p=0.470 n=6
Parse Time 6.62s (± 0.41%) 6.68s (± 0.71%) +0.06s (+ 0.86%) 6.62s 6.74s p=0.036 n=6
Bind Time 1.89s (± 0.27%) 1.88s (± 0.43%) ~ 1.87s 1.89s p=0.523 n=6
Check Time 31.98s (± 0.26%) 32.11s (± 0.28%) +0.12s (+ 0.38%) 31.93s 32.18s p=0.031 n=6
Emit Time 15.13s (± 0.21%) 15.19s (± 0.28%) +0.06s (+ 0.41%) 15.12s 15.24s p=0.030 n=6
Total Time 55.62s (± 0.16%) 55.86s (± 0.24%) +0.24s (+ 0.43%) 55.60s 55.97s p=0.020 n=6
mui-docs - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 2,501,812 2,501,812 ~ ~ ~ p=1.000 n=6
Types 909,643 909,643 ~ ~ ~ p=1.000 n=6
Memory used 2,319,231k (± 0.00%) 2,319,205k (± 0.00%) ~ 2,319,149k 2,319,270k p=0.149 n=6
Parse Time 9.28s (± 0.22%) 9.28s (± 0.16%) ~ 9.27s 9.31s p=0.934 n=6
Bind Time 2.16s (± 0.48%) 2.16s (± 0.83%) ~ 2.14s 2.18s p=0.801 n=6
Check Time 74.94s (± 0.32%) 74.90s (± 0.62%) ~ 74.47s 75.52s p=0.575 n=6
Emit Time 0.28s (± 2.70%) 0.28s (± 3.64%) ~ 0.27s 0.30s p=0.437 n=6
Total Time 86.66s (± 0.28%) 86.63s (± 0.53%) ~ 86.21s 87.25s p=0.575 n=6
self-build-src - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,250 1,225,251 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 266,546 266,546 ~ ~ ~ p=1.000 n=6
Memory used 2,354,424k (± 0.02%) 2,414,450k (± 6.14%) ~ 2,353,519k 2,717,312k p=0.298 n=6
Parse Time 5.22s (± 0.77%) 5.25s (± 1.16%) ~ 5.20s 5.37s p=0.575 n=6
Bind Time 1.78s (± 0.99%) 1.77s (± 0.85%) ~ 1.75s 1.79s p=1.000 n=6
Check Time 35.17s (± 0.25%) 35.06s (± 0.61%) ~ 34.65s 35.26s p=0.423 n=6
Emit Time 2.96s (± 2.19%) 2.93s (± 1.41%) ~ 2.87s 3.00s p=0.198 n=6
Total Time 45.15s (± 0.25%) 45.02s (± 0.44%) ~ 44.70s 45.30s p=0.230 n=6
self-build-src-public-api - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 1,225,250 1,225,251 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 266,546 266,546 ~ ~ ~ p=1.000 n=6
Memory used 2,421,465k (± 0.02%) 2,421,625k (± 0.01%) ~ 2,421,398k 2,422,027k p=0.810 n=6
Parse Time 5.49s (± 0.56%) 5.42s (± 0.95%) -0.07s (- 1.22%) 5.35s 5.49s p=0.030 n=6
Bind Time 1.81s (± 1.31%) 1.81s (± 1.14%) ~ 1.78s 1.84s p=0.935 n=6
Check Time 35.27s (± 0.19%) 35.23s (± 0.36%) ~ 35.00s 35.33s p=0.810 n=6
Emit Time 3.07s (± 5.16%) 3.03s (± 3.04%) ~ 2.95s 3.20s p=0.873 n=6
Total Time 45.62s (± 0.34%) 45.50s (± 0.44%) ~ 45.21s 45.81s p=0.173 n=6
self-compiler - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 262,222 262,223 +1 (+ 0.00%) ~ ~ p=0.001 n=6
Types 106,607 106,607 ~ ~ ~ p=1.000 n=6
Memory used 439,825k (± 0.01%) 439,866k (± 0.02%) ~ 439,797k 439,982k p=0.810 n=6
Parse Time 3.52s (± 0.59%) 3.53s (± 0.53%) ~ 3.51s 3.55s p=0.370 n=6
Bind Time 1.32s (± 1.21%) 1.32s (± 1.14%) ~ 1.29s 1.33s p=0.801 n=6
Check Time 19.00s (± 0.16%) 18.92s (± 0.69%) ~ 18.75s 19.08s p=0.335 n=6
Emit Time 1.53s (± 1.58%) 1.52s (± 0.79%) ~ 1.51s 1.54s p=0.566 n=6
Total Time 25.38s (± 0.18%) 25.30s (± 0.54%) ~ 25.11s 25.45s p=0.520 n=6
ts-pre-modules - node (v18.15.0, x64)
Errors 70 70 ~ ~ ~ p=1.000 n=6
Symbols 226,062 226,062 ~ ~ ~ p=1.000 n=6
Types 94,488 94,488 ~ ~ ~ p=1.000 n=6
Memory used 371,635k (± 0.04%) 371,591k (± 0.02%) ~ 371,526k 371,695k p=0.689 n=6
Parse Time 2.90s (± 1.10%) 2.90s (± 0.92%) ~ 2.86s 2.94s p=1.000 n=6
Bind Time 1.58s (± 0.87%) 1.58s (± 1.41%) ~ 1.55s 1.60s p=1.000 n=6
Check Time 16.48s (± 0.49%) 16.45s (± 0.32%) ~ 16.40s 16.55s p=0.628 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 20.97s (± 0.35%) 20.93s (± 0.30%) ~ 20.85s 21.04s p=0.375 n=6
vscode - node (v18.15.0, x64)
Errors 3 3 ~ ~ ~ p=1.000 n=6
Symbols 3,194,841 3,194,841 ~ ~ ~ p=1.000 n=6
Types 1,098,518 1,098,518 ~ ~ ~ p=1.000 n=6
Memory used 3,269,237k (± 0.01%) 3,269,281k (± 0.01%) ~ 3,268,770k 3,269,764k p=1.000 n=6
Parse Time 14.20s (± 0.83%) 14.18s (± 1.05%) ~ 14.06s 14.38s p=0.630 n=6
Bind Time 4.56s (± 2.03%) 4.52s (± 0.44%) ~ 4.49s 4.54s p=0.466 n=6
Check Time 87.87s (± 1.92%) 88.90s (± 2.91%) ~ 86.11s 93.20s p=0.575 n=6
Emit Time 27.68s (± 8.64%) 27.35s (± 7.91%) ~ 23.20s 28.96s p=0.810 n=6
Total Time 134.31s (± 1.14%) 134.95s (± 1.08%) ~ 133.24s 137.35s p=0.575 n=6
webpack - node (v18.15.0, x64)
Errors 0 0 ~ ~ ~ p=1.000 n=6
Symbols 288,743 288,743 ~ ~ ~ p=1.000 n=6
Types 117,156 117,156 ~ ~ ~ p=1.000 n=6
Memory used 441,034k (± 0.01%) 440,988k (± 0.03%) ~ 440,795k 441,139k p=0.575 n=6
Parse Time 4.08s (± 0.53%) 4.08s (± 0.96%) ~ 4.04s 4.14s p=0.936 n=6
Bind Time 1.75s (± 1.42%) 1.76s (± 1.22%) ~ 1.73s 1.79s p=0.295 n=6
Check Time 18.90s (± 0.34%) 18.87s (± 0.64%) ~ 18.72s 19.04s p=0.689 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.73s (± 0.35%) 24.72s (± 0.42%) ~ 24.57s 24.85s p=1.000 n=6
xstate-main - node (v18.15.0, x64)
Errors 5 5 ~ ~ ~ p=1.000 n=6
Symbols 552,390 552,390 ~ ~ ~ p=1.000 n=6
Types 185,096 185,096 ~ ~ ~ p=1.000 n=6
Memory used 492,470k (± 0.02%) 492,349k (± 0.03%) ~ 492,152k 492,495k p=0.199 n=6
Parse Time 3.43s (± 0.60%) 3.41s (± 0.64%) ~ 3.39s 3.45s p=0.122 n=6
Bind Time 1.18s (± 0.99%) 1.18s (± 0.83%) ~ 1.17s 1.19s p=0.555 n=6
Check Time 19.55s (± 1.20%) 19.71s (± 1.41%) ~ 19.37s 20.09s p=0.378 n=6
Emit Time 0.00s 0.00s ~ ~ ~ p=1.000 n=6
Total Time 24.15s (± 0.97%) 24.30s (± 1.16%) ~ 23.98s 24.67s p=0.520 n=6
System info unknown
Hosts
  • node (v18.15.0, x64)
Scenarios
  • Compiler-Unions - node (v18.15.0, x64)
  • angular-1 - node (v18.15.0, x64)
  • mui-docs - node (v18.15.0, x64)
  • self-build-src - node (v18.15.0, x64)
  • self-build-src-public-api - node (v18.15.0, x64)
  • self-compiler - node (v18.15.0, x64)
  • ts-pre-modules - node (v18.15.0, x64)
  • vscode - node (v18.15.0, x64)
  • webpack - node (v18.15.0, x64)
  • xstate-main - node (v18.15.0, x64)
Benchmark Name Iterations
Current pr 6
Baseline baseline 6

Developer Information:

Download Benchmarks

@gabritto gabritto requested a review from jakebailey December 3, 2024 22:38
@jakebailey jakebailey requested a review from rbuckton December 3, 2024 23:04
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 looks good to me, though I am still on the fence about canHaveFlowNode a bit. Maybe it was a bad suggestion.

@jakebailey
Copy link
Member

Well, it at least prevents us from tacking undefined onto something that doesn't need it, but, the .flowNode check already did that too...

@gabritto
Copy link
Member Author

gabritto commented Dec 3, 2024

This looks good to me, though I am still on the fence about canHaveFlowNode a bit. Maybe it was a bad suggestion.

I think it probably doesn't matter a lot? I think accesses to node properties in bindChildren are megamorphic already, no?
I don't know that I want to go and try to perf test this beyond the standard benchmark, as it would require some setup for changing the file and having reuse and unreachable nodes etc. Maybe @rbuckton has an opinion.

@gabritto gabritto merged commit 6b1ea96 into main Dec 4, 2024
31 checks passed
@gabritto gabritto deleted the gabritto/issue60597 branch December 4, 2024 17:13
@sandersn sandersn removed this from PR Backlog Apr 22, 2025
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.

[TypeScript] Revealing Unreachable code breaks diagnostics
4 participants