-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Cache property name widening contexts #40732
Conversation
When creating a new `WideningContext` for a given property, check whether there's an existing `WideningContext` with the same `parent` and `propertyName`. Otherwise, we won't adequately leverage the cache of computed `siblings` stored on the `WideningContext`.
@typescript-bot perf test this |
Heya @amcasey, I've started to run the perf test suite on this PR at 647421f. You can monitor the build here. Update: The results are in! |
Here's a cleaned up and annotated repro. |
@amcasey Here they are:Comparison Report - master..40732
System
Hosts
Scenarios
|
@amcasey seems like this is ready to merge? Or does it need to wait for 4.2? |
@sandersn I was saving it for 4.2, but only because there's no rush. |
With #40778 the motivating example no longer creates a large union type, so I wonder if this PR is still worth doing? |
@ahejlsberg I'm a little concerned that it'll bite us again in the future if we leave it quadratic, but I agree that there's no urgency. Your call. |
When creating a new
WideningContext
for a given property, check whetherthere's an existing
WideningContext
with the sameparent
andpropertyName
. Otherwise, we won't adequately leverage the cache ofcomputed
siblings
stored on theWideningContext
.On my box, check time drops from 10 seconds to 0.3 seconds for this example.