Skip to content

Conversation

@kdy1
Copy link
Member

@kdy1 kdy1 commented Feb 21, 2025

Description:

The analyzer of the DCE pass can be parallelized in a similar way to mark-sweep GC. It currently uses &mut petgraph::DiGraphMap to find reachable bindings, but we can split the graph creation into multiple threads.

Also, I decided to amort allocations because swc_parallel::join is called an enormous amount of time, meaning that it will be slower if I allocate one hashmap from each closure. I'll use thread_local crate to reuse the hashmap and collect all of them after the traversal is done.

@kdy1 kdy1 changed the title Dep on thread_local perf(es/minifier): Make DCE analyzer parallel Feb 21, 2025
Copy link
Member Author

kdy1 commented Feb 21, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

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

@kdy1 kdy1 added this to the Planned milestone Feb 21, 2025
@kdy1 kdy1 changed the base branch from kdy1/par-merge to graphite-base/10076 February 21, 2025 04:59
@kdy1 kdy1 force-pushed the graphite-base/10076 branch from 2805cfc to f33b0bc Compare February 21, 2025 04:59
@kdy1 kdy1 changed the base branch from graphite-base/10076 to main February 21, 2025 04:59
@changeset-bot
Copy link

changeset-bot bot commented Feb 21, 2025

⚠️ No Changeset found

Latest commit: c707a0a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@changeset-bot
Copy link

changeset-bot bot commented Feb 21, 2025

⚠️ No Changeset found

Latest commit: 6f16e73

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kdy1 kdy1 changed the base branch from main to graphite-base/10076 February 21, 2025 05:02
@kdy1 kdy1 changed the base branch from graphite-base/10076 to kdy1/par-merge February 21, 2025 05:03
@kdy1 kdy1 changed the base branch from kdy1/par-merge to graphite-base/10076 March 25, 2025 13:16
@kdy1 kdy1 changed the base branch from graphite-base/10076 to main March 25, 2025 16:07
@kdy1 kdy1 changed the base branch from main to graphite-base/10076 March 25, 2025 16:10
@kdy1 kdy1 changed the base branch from graphite-base/10076 to kdy1/par-merge March 25, 2025 16:10
@codspeed-hq
Copy link

codspeed-hq bot commented Mar 25, 2025

CodSpeed Performance Report

Merging #10076 will degrade performances by 1.54%

Comparing kdy1/dce-par (c707a0a) with main (78e37a1)

Summary

⚡ 3 improvements
❌ 1 regressions
✅ 148 untouched benchmarks

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

Benchmarks breakdown

Benchmark BASE HEAD Change
serialization of serde 2.8 µs 2.8 µs +1.06%
es/minifier/libs/antd 2.6 s 2.6 s -1.54%
es/minifier/libs/terser 409 ms 402 ms +1.76%
es/minifier/libs/vue 173.1 ms 170.7 ms +1.41%

Base automatically changed from kdy1/par-merge to main March 25, 2025 16:34
@kdy1
Copy link
Member Author

kdy1 commented May 19, 2025

This is not required anymore

@kdy1 kdy1 closed this May 19, 2025
@kdy1 kdy1 deleted the kdy1/dce-par branch May 19, 2025 02:59
@kdy1 kdy1 modified the milestones: Planned, v1.11.28 May 20, 2025
@swc-project swc-project locked as resolved and limited conversation to collaborators Jun 20, 2025
@kdy1 kdy1 modified the milestones: v1.11.28, Planned Jun 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants