Enable caching for control flow paths that precede loops - #33510
Conversation
|
TypeScript Bot (@typescript-bot) perf test this |
|
Heya Anders Hejlsberg (@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 Anders Hejlsberg (@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. |
|
Anders Hejlsberg (@ahejlsberg) Here they are:Comparison Report - master..33510
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Wesley Wigham (weswigham)
left a comment
There was a problem hiding this comment.
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 (@typescript-bot) perf test this |
|
Heya Anders Hejlsberg (@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 Anders Hejlsberg (@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! |
|
Anders Hejlsberg (@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 |
| if (!reference.flowNode || !couldBeUninitialized && !(declaredType.flags & TypeFlags.Narrowable)) { | ||
| return declaredType; | ||
| } | ||
| flowInvocationCount++; |
There was a problem hiding this comment.
Nothing ever decrements this - that intentional?
There was a problem hiding this comment.
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.