-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Enable caching for control flow paths that precede loops #33510
Conversation
@typescript-bot perf test this |
Heya @ahejlsberg, I've started to run the perf test suite on this PR at 7b77b49. You can monitor the build here. It should now contribute to this PR's status checks. Update: The results are in! |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at 7b77b49. You can monitor the build here. It should now contribute to this PR's status checks. |
@ahejlsberg Here they are:Comparison Report - master..33510
System
Hosts
Scenarios
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks fine, but why's the perf a problem? Is there less caching going on now? Too many more loop cache entries causing memory chrun?
@typescript-bot perf test this |
Heya @ahejlsberg, I've started to run the extended test suite on this PR at d4ad0d5. You can monitor the build here. It should now contribute to this PR's status checks. |
Heya @ahejlsberg, I've started to run the perf test suite on this PR at d4ad0d5. You can monitor the build here. It should now contribute to this PR's status checks. Update: The results are in! |
@ahejlsberg Here they are:Comparison Report - master..33510
System
Hosts
Scenarios
|
Optimized our flow assignment caching scheme for an overall ~2% reduction in check time. Now, we only cache when resolution of the cached value involves a recursive invocation of |
@@ -16990,6 +16984,7 @@ namespace ts { | |||
if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & TypeFlags.Narrowable)) { | |||
return declaredType; | |||
} | |||
flowInvocationCount++; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nothing ever decrements this - that intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's just a monotonically increasing count that allows us to detect if the function was (recursively) invoked.
This PR tweaks our control flow analysis logic for loops to ensure that caching of assignment nodes occurs in control flow paths that precede loops.