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

perf(linter): performance improvement for css semantic model #4044

Merged
merged 7 commits into from
Sep 23, 2024

Conversation

togami2864
Copy link
Contributor

@togami2864 togami2864 commented Sep 22, 2024

Summary

According to the profile, get_rule_by_range and process_selector significantly affect performance.

I implemented the following improvements to address these issues:

  • Replaced FxHashMap with BTreeMap to search range_to_rule more efficiently.
  • Used Cow to minimize unnecessary memory allocation in process_selector
  • Removed unused functions.

Test Plan

CI should pass

@togami2864 togami2864 self-assigned this Sep 22, 2024
@github-actions github-actions bot added A-Core Area: core A-Linter Area: linter L-CSS Language: CSS labels Sep 22, 2024
@togami2864 togami2864 changed the title perf(linter): Performance improvement for css semantic model perf(linter): performance improvement for css semantic model Sep 22, 2024
Copy link

codspeed-hq bot commented Sep 22, 2024

CodSpeed Performance Report

Merging #4044 will degrade performances by 6.6%

Comparing togami2864:perf/semantic-css (341558f) with main (b3724b2)

Summary

⚡ 5 improvements
❌ 1 regressions
✅ 101 untouched benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main togami2864:perf/semantic-css Change
css_analyzer[bootstrap_18416142857265205439.css] 255.9 ms 203.6 ms +25.66%
css_analyzer[bulma_5641719244145477318.css] 784.5 ms 645.5 ms +21.53%
css_analyzer[foundation_11602414662825430680.css] 158.4 ms 139.9 ms +13.25%
css_analyzer[tachyons_11778168428173736564.css] 151.7 ms 112.7 ms +34.53%
react.production.min_3378072959512366797.js[cached] 1.8 ms 2 ms -6.6%
db_17847247775464589309.json[uncached] 16.3 ms 15.2 ms +7.33%

@togami2864 togami2864 marked this pull request as ready for review September 23, 2024 14:42
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome job @togami2864 !!

@ematipico ematipico merged commit a3483e4 into biomejs:main Sep 23, 2024
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Core Area: core A-Linter Area: linter L-CSS Language: CSS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants