Skip to content

perf(mangler): replace FixedBitSet with BitSet based on Rolldown's implementation#13419

Merged
graphite-app[bot] merged 1 commit intomainfrom
08-30-perf_mangler_replace_fixedbitset_with_bitset_based_on_rolldown_s_implementation
Aug 30, 2025
Merged

perf(mangler): replace FixedBitSet with BitSet based on Rolldown's implementation#13419
graphite-app[bot] merged 1 commit intomainfrom
08-30-perf_mangler_replace_fixedbitset_with_bitset_based_on_rolldown_s_implementation

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Aug 30, 2025

Just recalled that there's a bitset implementation in rolldown that is not complicated. I've copied that and change it to use the allocator. This might work?

refs #11347

@github-actions github-actions bot added the C-performance Category - Solution not expected to change functional behavior, only performance label Aug 30, 2025
Copy link
Member Author


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@codspeed-hq
Copy link

codspeed-hq bot commented Aug 30, 2025

CodSpeed Instrumentation Performance Report

Merging #13419 will degrade performances by 17.18%

Comparing 08-30-perf_mangler_replace_fixedbitset_with_bitset_based_on_rolldown_s_implementation (e473b83) with main (f97283b)1

Summary

⚡ 1 improvements
❌ 2 regressions
✅ 34 untouched benchmarks

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

Benchmarks breakdown

Benchmark BASE HEAD Change
mangler[RadixUIAdoptionSection.jsx] 14.7 µs 11.9 µs +24.02%
mangler[binder.ts] 828.6 µs 894.9 µs -7.41%
mangler[cal.com.tsx] 3.4 ms 4.1 ms -17.18%

Footnotes

  1. No successful run was found on main (e473b83) during the generation of this report, so f97283b was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@sapphi-red sapphi-red force-pushed the 08-30-perf_mangler_replace_fixedbitset_with_bitset_based_on_rolldown_s_implementation branch from 4db95f0 to 32827de Compare August 30, 2025 09:38
@sapphi-red sapphi-red marked this pull request as ready for review August 30, 2025 10:36
Copilot AI review requested due to automatic review settings August 30, 2025 10:36
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the external FixedBitSet dependency with a custom BitSet implementation based on Rolldown's implementation to improve performance in the mangler. The custom implementation uses the allocator for memory management.

  • Removes the fixedbitset dependency and implements a custom BitSet struct
  • Updates mangler code to use the new BitSet API methods (has_bit, set_bit)
  • Integrates the new BitSet with the existing allocator system for better memory management

Reviewed Changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_mangler/src/lib.rs Updates imports and replaces FixedBitSet usage with custom BitSet
crates/oxc_mangler/src/bitset.rs Adds new custom BitSet implementation with allocator support
crates/oxc_mangler/Cargo.toml Removes fixedbitset dependency
Cargo.toml Removes fixedbitset from workspace dependencies

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@Boshen Boshen added the 0-merge Merge with Graphite Merge Queue label Aug 30, 2025
Copy link
Member

Boshen commented Aug 30, 2025

Merge activity

…s implementation (#13419)

Just recalled that there's a bitset implementation in rolldown that is not complicated. I've copied that and change it to use the allocator. This might work?

refs #11347
@graphite-app graphite-app bot force-pushed the 08-30-perf_mangler_replace_fixedbitset_with_bitset_based_on_rolldown_s_implementation branch from 32827de to e473b83 Compare August 30, 2025 11:22
@graphite-app graphite-app bot merged commit e473b83 into main Aug 30, 2025
25 checks passed
@graphite-app graphite-app bot deleted the 08-30-perf_mangler_replace_fixedbitset_with_bitset_based_on_rolldown_s_implementation branch August 30, 2025 11:27
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Aug 30, 2025
graphite-app bot pushed a commit that referenced this pull request Aug 31, 2025
#13419 introduced a `BitSet` type which stores its data in the arena, in the mangler.

This type may be useful in other contexts, so move it from `oxc_mangler` into `oxc_allocator`. But put it behind a `bitset` feature, so only crates which use it pay for it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants