Cache property name widening contexts#40732
Closed
amcasey wants to merge 1 commit intomicrosoft:masterfrom
Closed
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`.
Member
Author
|
@typescript-bot perf test this |
Collaborator
|
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! |
Member
Author
|
Here's a cleaned up and annotated repro. |
Collaborator
|
@amcasey Here they are:Comparison Report - master..40732
System
Hosts
Scenarios
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
weswigham
approved these changes
Sep 25, 2020
Member
|
@amcasey seems like this is ready to merge? Or does it need to wait for 4.2? |
Member
Author
|
@sandersn I was saving it for 4.2, but only because there's no rush. |
Member
|
With #40778 the motivating example no longer creates a large union type, so I wonder if this PR is still worth doing? |
Member
Author
|
@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. |
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When creating a new
WideningContextfor a given property, check whetherthere's an existing
WideningContextwith the sameparentandpropertyName. Otherwise, we won't adequately leverage the cache ofcomputed
siblingsstored on theWideningContext.On my box, check time drops from 10 seconds to 0.3 seconds for this example.