-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Cache most calls to isRelatedTo #17950
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
Conversation
I recall that we previously rejected caching union and intersection comparison results because of the increased memory consumption and increased GC churn (from allocating key strings for cache lookups). We definitely need some numbers to determine that there's no negative impact on large codebases that otherwise aren't affected by the problem we're trying to solve. |
9581cd7
to
070ad50
Compare
Perf-wise, there's no difference on our perf projects. Memory-wise, it uses ~1% more memory. |
9e8229d
to
9bffb20
Compare
This change cuts 27s off the wall-clock time that |
@weswigham What is the corresponding change in memory consumption? |
Error caching is a losing game Only safe caches Carve out a few more safe cache uses Lifted cache from recursiveTypeRelatedTo, shows need for elaboration cache Cache more outputs, accept elaboration-omitting baselines Remove whitespace
9bffb20
to
fd8df1e
Compare
Perf data for master@ 1b5a0ae vs this branch compiling the version of our compiler which uses unions in tsperf:
Significant improvements to check time in exchange for higher memory usage, as expected. |
@ahejlsberg perf data (including memory) collected. |
Thanks for your contribution. This PR has not been updated in a while and cannot be automatically merged at the time being. For housekeeping purposes we are closing stale PRs. If you'd still like to continue working on this PR, please leave a message and one of the maintainers can reopen it. |
This lifts the cache used within
recursiveTypeRelatedTo
up toisRelatedTo
as a whole; enabling the results of comparing unions and intersections of types to be cached.As a side effect of caching the results, this causes us to no longer duplicate elaborations for the newly cached types across multiple diagnostic messages, similarly to what we were already doing for structured types.
Combined with #17947, @sandersn and I saw significant improvements in the compilation time of some type-heavy compilations.