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

chore: switch from browserslist-rs to oxc-browserslist #9014

Closed

Conversation

cijiugechu
Copy link

Description:

oxc-browserslist is a fork of browserslist-rs with improved performance, actively maintained by oxc-project. The following are the changes made to it after the fork:

  • reduced compilation speed from one minute to a few seconds
  • removed all unnecessary, heavy or slow dependencies: ahash, chrono, either, indexmap, itertools, once_cell, string_cache
  • improved some runtime performance, e.g. improve sort method, precompute versions

BREAKING CHANGE:

Related issue (if exists):

@cijiugechu cijiugechu requested a review from a team as a code owner June 3, 2024 02:12
@CLAassistant
Copy link

CLAassistant commented Jun 3, 2024

CLA assistant check
All committers have signed the CLA.

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@kdy1
Copy link
Member

kdy1 commented Jun 3, 2024

@g-plane Thoughts?

@g-plane
Copy link
Contributor

g-plane commented Jun 3, 2024

oxc-browserslist generates browserslist data into .rs files and they commit them into Git, while browserslist-rs uses build.rs to generate files to target directory at compilation time. That's the biggest difference.

@kwonoj
Copy link
Member

kwonoj commented Jun 3, 2024

  • would like to know if there's a reason to choose fork instead of upstream, at least wasn't able to see discussion around upstream repo.

@g-plane
Copy link
Contributor

g-plane commented Jun 3, 2024

If using Browserslist is not a hot path of SWC, this change is subtle. (Optimization should be considered for hot paths first.)

@cijiugechu
Copy link
Author

Considering that swc is the upstream repository for many projects, even minor changes can benefit many downstreams.

@kwonoj
Copy link
Member

kwonoj commented Jun 3, 2024

That applies if any upstream / downstream packages rely on swc also switch their dependency / transitive dependencies to this forked pkg, isn't it? While the implication might not be measurable, that'll take a longer way than if upstream adapts some improvements. As shared above, would like to understand why fork has to be created.

@kdy1 kdy1 added this to the Planned milestone Jun 5, 2024
@kdy1
Copy link
Member

kdy1 commented Jun 5, 2024

I think the improvement of the compile time is important difference, but I want to hear about the reason of creating a fork instead of sending a patch to original project

kdy1 added a commit that referenced this pull request Jul 1, 2024
**Description:**

Compilation time of browserslist-rs has beed reduced by 32%. See:
browserslist/browserslist-rs#23

But, it's still slower that oxc-browserslist:


![image](https://github.com/swc-project/swc/assets/17216317/44602603-e33f-442e-9ee0-242061089397)

while browserslist-rs costs about 3.9s.




**Related issue:**

Close #9014

---------

Co-authored-by: 강동윤 (Donny) <[email protected]>
@kdy1 kdy1 closed this in #9023 Jul 1, 2024
@kdy1 kdy1 modified the milestones: Planned, v1.6.7 Jul 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants