Re-use existing entries in the rule cache #9208
Merged
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.
We didn't re-use existing entries in the rule cache when adding new candidates. This means the rule cache, when introducing new classes, grew by a much larger amount than it should have. In some cases even doubling in size. Over time this results in a pretty significant slow down. When this happens repeatedly it can cause rebuilds to go from ~20ms to over 650ms for a large number of classes.
Also, because of our not reusing entries from this cache, we would duplicate rules when changing from classes with the same high level sort order. E.g.
ml-2 ml-4
toml-2 ml-6
(on separate elements but appearing in this order in the source).I added two changeling entries for this because this change happens to fix two very different acting bugs so it seems reasonable to add more than one entry to the changeling.
Fixes #7449
Fixes #9205