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: use mimalloc for musl target #6071

Merged
merged 1 commit into from
Apr 2, 2024

Conversation

xc2
Copy link
Collaborator

@xc2 xc2 commented Mar 30, 2024

Summary

closes: #6072

related: #6065

linux musl binding now performs ~3x times faster than before.

sample of 0.5.9

Running case debian (GNU)
Rspack compiled successfully in 1.67 s

Running case alpine (musl)
Rspack compiled successfully in 6.39 s

Running case alpine-mimalloc-v1 (musl, redirecting malloc to mimalloc 1.8.2)
Rspack compiled successfully in 1.78 s

Running case alpine-mimalloc-v2 (musl, redirecting malloc to mimalloc 2.1.2)
Rspack compiled successfully in 1.70 s

sample of this change

Running case debian (GNU, nothing change in this pr)
Rspack compiled successfully in 1.86 s

Running case alpine (musl, with mimalloc rust binding)
Rspack compiled successfully in 1.97 s

Running case alpine-mimalloc-v1 (musl, with mimalloc rust binding, redirecting malloc to mimalloc 1.8.2)
Rspack compiled successfully in 1.89 s

Running case alpine-mimalloc-v2 (musl, with mimalloc rust binding, redirecting malloc to mimalloc 2.1.2)
Rspack compiled successfully in 1.81 s

Checklist

  • Tests updated (or not required): no need
  • Documentation updated (or not required): no need

@github-actions github-actions bot added the release: performance release: performance related release(mr only) label Mar 30, 2024
@xc2
Copy link
Collaborator Author

xc2 commented Mar 30, 2024

!canary

Copy link

netlify bot commented Mar 30, 2024

Deploy Preview for rspack canceled.

Built without sensitive environment variables

Name Link
🔨 Latest commit c33ff59
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6608257364659f0008e12341

Copy link
Contributor

0.5.9-canary-df5312d-20240330095228

@xc2 xc2 closed this Mar 30, 2024
@xc2
Copy link
Collaborator Author

xc2 commented Mar 30, 2024

!canary

Copy link
Contributor

0.5.9-canary-16e548a-20240330113014

@xc2 xc2 reopened this Mar 30, 2024
@xc2 xc2 force-pushed the perf/mimalloc-for-musl branch 2 times, most recently from b4c249e to ad947a6 Compare March 30, 2024 13:56
@xc2 xc2 changed the title perf: use mimalloc for musl build perf: use mimalloc for musl target Mar 30, 2024
@xc2 xc2 marked this pull request as ready for review March 30, 2024 15:39
@xc2 xc2 requested a review from hardfist as a code owner March 30, 2024 15:39
@xc2 xc2 requested a review from h-a-n-a March 30, 2024 15:39
@hardfist
Copy link
Contributor

!bench

@rspack-bot
Copy link

rspack-bot commented Mar 30, 2024

📝 Benchmark detail: Open

Name Base (2024-03-30 48aa3b9) Current Change
10000_development-mode + exec 2.07 s ± 41 ms 2.06 s ± 13 ms -0.61 %
10000_development-mode_hmr + exec 765 ms ± 5.1 ms 764 ms ± 12 ms -0.16 %
10000_production-mode + exec 2.95 s ± 22 ms 3.05 s ± 25 ms +3.35 %
arco-pro_development-mode + exec 2.46 s ± 38 ms 2.49 s ± 31 ms +1.38 %
arco-pro_development-mode_hmr + exec 489 ms ± 3.6 ms 490 ms ± 2.9 ms +0.05 %
arco-pro_development-mode_hmr_intercept-plugin + exec 506 ms ± 4.8 ms 508 ms ± 7.7 ms +0.34 %
arco-pro_development-mode_intercept-plugin + exec 3.34 s ± 34 ms 3.38 s ± 72 ms +1.33 %
arco-pro_production-mode + exec 4.15 s ± 35 ms 4.15 s ± 38 ms -0.06 %
arco-pro_production-mode_intercept-plugin + exec 5.02 s ± 61 ms 5.01 s ± 25 ms -0.12 %
threejs_development-mode_10x + exec 1.9 s ± 47 ms 1.87 s ± 28 ms -1.38 %
threejs_development-mode_10x_hmr + exec 729 ms ± 9 ms 729 ms ± 4.3 ms -0.01 %
threejs_production-mode_10x + exec 5.73 s ± 34 ms 5.86 s ± 148 ms +2.29 %

@h-a-n-a
Copy link
Collaborator

h-a-n-a commented Apr 1, 2024

@xc2
Copy link
Collaborator Author

xc2 commented Apr 1, 2024

Seems like we can use mimalloc for everything. https://github.com/napi-rs/node-rs/blob/70d7fa72262c6e547950b30daa2d03583a1b04bd/crates/alloc/Cargo.toml

yea it's good to make the allocator unified but i didn't make the change as i found it didn't help much on performance for glibc linked binary.

and i need more effort to check if these change below works well. let me check if i got time later.

  • mimalloc-rust -> mimalloc
  • tikv-jemalloc -> mimalloc

Copy link
Contributor

@Boshen Boshen left a comment

Choose a reason for hiding this comment

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

Let's fix the musl performance issue first and try changing to mimalloc in another PR.

@Boshen Boshen merged commit 5be4c34 into web-infra-dev:main Apr 2, 2024
36 checks passed
@xc2 xc2 deleted the perf/mimalloc-for-musl branch April 2, 2024 11:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release: performance release: performance related release(mr only)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

use mimalloc allocator in linux
5 participants