Skip to content
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

Re-use existing entries in the rule cache #9208

merged 3 commits into from Aug 29, 2022


Copy link

@thecrypticace thecrypticace commented Aug 29, 2022

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 to ml-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

@thecrypticace thecrypticace marked this pull request as ready for review August 29, 2022 18:07
@thecrypticace thecrypticace merged commit 58cc7ed into master Aug 29, 2022
@thecrypticace thecrypticace deleted the fix/memory-leak-and-duplicates branch August 29, 2022 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

Using important: true leads to duplicate rules in output Tailwind CLI slow down / memory leak
1 participant