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

Use BitSet for bundler intersections #8862

Merged
merged 10 commits into from
Mar 2, 2023
Merged

Use BitSet for bundler intersections #8862

merged 10 commits into from
Mar 2, 2023

Conversation

mattcompiles
Copy link
Contributor

@mattcompiles mattcompiles commented Feb 27, 2023

↪️ Pull Request

In really large projects, the bundler can spend huge amounts of time performing expensive set intersections. This PR replaces Set's with a custom BitSet class implemented with BigInt when intersections are needed to be performed.

The BitSet requires a list of all possible items before individual sets can be made. In the case of the bundler, this is the list of all known assets.

Unfortunately, we don't really see any performance wins on most projects but a large internal project saw a 44 second improvement to dev bundle time.

Bonus change
I upgraded our eslint config to es2020 to add support for BigInts

🚨 Test instructions

Tests added, plus existing bundler tests should be sufficient

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

@devongovett devongovett merged commit 53b215a into v2 Mar 2, 2023
@devongovett devongovett deleted the mjones/bitset branch March 2, 2023 15:27
lettertwo added a commit that referenced this pull request Nov 6, 2023
* upstream/v2: (128 commits)
  [webextension] Add support for `chrome_style` (#8867)
  Switch to SWC minifier by default (#8860)
  Use BitSet for bundler intersections (#8862)
  best key logic truncating package names (#8865)
  Add support for loadConfig to resolver plugins (#8847)
  Missing edge for multiple targets (#8854)
  Split large runtime manifest into separate bundles (#8837)
  Improvements to new resolver (#8844)
  Fix published files for resolver
  New resolver implementation in Rust (#8807)
  Update yarn.lock (#8843)
  Bump napi-rs to latest (#8838)
  Support .proxyrc.cjs  (#8833)
  Sort global deps before injecting imports (#8818)
  Sort CSS module exports (#8817)
  fix: add extra information to unique bundles (#8784)
  Don't blow up HMR when <link />s don't have hrefs (#8800)
  v2.8.3
  Changelog for v2.8.3
  Address bug by updating an asset reference and merge conditions (#8762)
  ...
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.

2 participants