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

Only remove duplicate Tailwind classes #277

Merged
merged 16 commits into from
Jun 3, 2024

Conversation

WooWan
Copy link
Contributor

@WooWan WooWan commented Jun 1, 2024

Summary

The change improves the performance of removing duplicated classNames. In this pull request, I replace the indexOf and splice functions, which have O(n) time complexity, with two separate array filters and a Set().

Comparison

  • Before Change: O(n^2) due to the nested indexOf and splice operations within the filter method.

  • After Change: O(n) due to the use of a Set for constant-time duplicate checks and separate filtering steps.

@thecrypticace thecrypticace changed the title Improve remove duplicate classes Only remove duplicate Tailwind classes Jun 3, 2024
@thecrypticace thecrypticace merged commit 82ea71a into tailwindlabs:main Jun 3, 2024
1 check passed
@thecrypticace
Copy link
Contributor

Thanks! I'd planned to make this improvement this week alongside improving duplicate removal such that it only applies to Tailwind classes but this gave me the push to go ahead and get that done. 🔥

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants