- Notifications
You must be signed in to change notification settings - Fork13.2k
Omit effects-free conditional constructs from control flow graph#58013
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
ahejlsberg commentedMar 31, 2024
@typescript-bot test it |
typescript-bot commentedMar 31, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
typescript-bot commentedMar 31, 2024
Hey@ahejlsberg, the results of running the DT tests are ready. Everything looks the same! |
typescript-bot commentedMar 31, 2024
@ahejlsberg Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
typescript-bot commentedMar 31, 2024
@ahejlsberg Here are the results of running the user tests comparing Something interesting changed - please have a look. Details |
ahejlsberg commentedMar 31, 2024
@typescript-bot test it |
typescript-bot commentedMar 31, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
typescript-bot commentedMar 31, 2024
Hey@ahejlsberg, the results of running the DT tests are ready. Everything looks the same! |
typescript-bot commentedMar 31, 2024
@ahejlsberg Here are the results of running the user tests comparing Something interesting changed - please have a look. Details |
typescript-bot commentedMar 31, 2024
@ahejlsberg Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
typescript-bot commentedMar 31, 2024
@ahejlsberg Here are the results of running the top 400 repos comparing Everything looks good! |
1 similar comment
typescript-bot commentedMar 31, 2024
@ahejlsberg Here are the results of running the top 400 repos comparing Everything looks good! |
ahejlsberg commentedApr 1, 2024
@typescript-bot user test this |
typescript-bot commentedApr 1, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
typescript-bot commentedApr 1, 2024
@ahejlsberg Here are the results of running the user tests comparing Something interesting changed - please have a look. Details |
typescript-bot commentedApr 1, 2024
@ahejlsberg Here they are:tscComparison Report - baseline..pr
System info unknown Hosts
Scenarios
Developer Information: | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ahejlsberg commentedApr 2, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
@jakebailey Any idea why we're seeing the test failure here#58013 (comment)? I can't reproduce it locally. Meaning, when I run |
ahejlsberg commentedApr 2, 2024
@jakebailey Ok, I wasn't running with |
jakebailey commentedApr 2, 2024
I was out yesterday; will take a look at this shortly. |
jakebailey commentedApr 2, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Cloning webpack, doing $git clone git@github.com:webpack/webpack.git$cd webpack$yarn$node~/work/TypeScript/built/local-old/tsc.js -p tsconfig.types.json|& tee~/out-main.txt$node~/work/TypeScript/built/local/tsc.js -p tsconfig.types.json|& tee~/out-pr.txt$wc -l~/out-main.txt~/out-pr.txt 3188 /home/jabaile/out-main.txt 3187 /home/jabaile/out-pr.txt 6375 total$gdiff~/out-main.txt~/out-pr.txt diff --git a/home/jabaile/out-main.txt b/home/jabaile/out-pr.txtindex c825c4baf..0b70c6f9f 100644--- a/home/jabaile/out-main.txt+++ b/home/jabaile/out-pr.txt@@ -2004,7 +2004,6 @@ lib/optimize/SplitChunksPlugin.js(1011,30): error TS7006: Parameter 'key' implic lib/optimize/SplitChunksPlugin.js(1022,37): error TS7006: Parameter 'key' implicitly has an 'any' type. lib/optimize/SplitChunksPlugin.js(1095,35): error TS18048: 'cacheGroup.minChunks' is possibly 'undefined'. lib/optimize/SplitChunksPlugin.js(1099,9): error TS2722: Cannot invoke an object which is possibly 'undefined'.-lib/optimize/SplitChunksPlugin.js(1099,9): error TS18048: 'cacheGroup.getName' is possibly 'undefined'. lib/optimize/SplitChunksPlugin.js(1254,21): error TS18048: 'cacheGroup.minChunks' is possibly 'undefined'. lib/optimize/SplitChunksPlugin.js(1687,37): error TS7006: Parameter 'value' implicitly has an 'any' type. lib/optimize/SplitChunksPlugin.js(1687,44): error TS7006: Parameter 'key' implicitly has an 'any' type. This difference appears no matter what order I run things or the clean-ness of the repo. So, I think the bot is correct here. |
jakebailey commentedApr 2, 2024 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Also, I modified this PR to force Trial and error says that it's something to do with the |
ahejlsberg commentedApr 3, 2024
@jakebailey Yeah, sorry, I see what's going on now. What confused me is that we used to issue two errors, and now we only issue one, but the errors have the exact same location. The missing error is an effect of optimizing away part of the control flow graph, causing us to not call |
ahejlsberg commentedApr 3, 2024
Now that we've sorted out the missing error, I think this is ready for a review. |
Uh oh!
There was an error while loading.Please reload this page.
With this PR we optimize control flow graph construction to omit conditional constructs that have no control flow effects. Consider this example:
This currently creates the following control flow graph for the reference to
xin thefoo(x)call:With this PR, the effects-free conditional operator expression is removed from the control flow graph for references that follow it in the graph:
Intuitively, this optimization is possible because the observed control flow types at the bottomBranchLabel node are the same as the observed control flow types at theStart node for any variable, parameter, or property reference.
The shallower control flow graphs reduce check time up to 2% in several projects.