perf(jss): optimize combineSelectors from O(n²) to O(n) (#234)#1023
perf(jss): optimize combineSelectors from O(n²) to O(n) (#234)#1023jitendravyas wants to merge 1 commit intoacss-io:mainfrom
Conversation
Replace nested loop implementation with inverted hash approach for combining CSS selectors with the same property/value pair. Before: O(n²) - nested loops comparing all pairs After: O(n) - single pass using hash map lookup This significantly improves performance for large stylesheets with many atomic classes. Fixes acss-io#234
|
|
@claude is attempting to deploy a commit to the Atomizer Team on Vercel. A member of the Team first needs to authorize it. |
|
Did you test this to make sure nothing broke? Do we have tests that cover this use case? What speed improvement do we see from this? |
|
no i did not test. how to do it? |
Replace nested loop implementation with inverted hash approach for combining CSS selectors with the same property/value pair.
Before: O(n²) - nested loops comparing all pairs
After: O(n) - single pass using hash map lookup
This significantly improves performance for large stylesheets with many atomic classes.
Fixes #234
I confirm that this contribution is made under a BSD license and that I have the authority necessary to make this contribution on behalf of its copyright owner.
Description
Describe your changes in detail.
Motivation and Context
Why is this change required? What problem does it solve?
How Has This Been Tested?
Please describe in detail how you tested your changes. Include details of your testing environment, and the tests you ran to see how your change affects other areas of the code, etc.
Types of changes
What types of changes does your code introduce? Put an x in all the boxes that apply:
Checklist
Review the following points, and put an x in all the boxes that apply. If you’re unsure about any of these, don’t hesitate to ask. We’re here to help!