Skip to content

perf: reuse js module between compilation#9265

Merged
SyMind merged 26 commits intomainfrom
perf-reuse-js-instrance-between-compilation
Feb 17, 2025
Merged

perf: reuse js module between compilation#9265
SyMind merged 26 commits intomainfrom
perf-reuse-js-instrance-between-compilation

Conversation

@SyMind
Copy link
Copy Markdown
Member

@SyMind SyMind commented Feb 12, 2025

Summary

perf: reuse js module between compilation

  1. Merged the rspack_binding_values crate into the node_binding crate.
  2. JsModule now uses WeakReference<JsCompiler> to reference the last compilation.
  3. Ref for JsModule will be cleaned up when the compiler is garbage collected and during the compilation.hooks.revoked_modules hook.

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@netlify
Copy link
Copy Markdown

netlify bot commented Feb 12, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 266daa5
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67b31e552b7f390008b7fdd0
😎 Deploy Preview https://deploy-preview-9265--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@SyMind SyMind force-pushed the perf-reuse-js-instrance-between-compilation branch from c7c075e to b436594 Compare February 12, 2025 10:07
@github-actions github-actions bot added release: performance release: performance related release(mr only) team The issue/pr is created by the member of Rspack. labels Feb 12, 2025
@SyMind SyMind force-pushed the perf-reuse-js-instrance-between-compilation branch from b436594 to 4b17353 Compare February 12, 2025 10:14
@SyMind SyMind force-pushed the perf-reuse-js-instrance-between-compilation branch from 3f54c37 to 2ada3ac Compare February 13, 2025 03:45
@SyMind SyMind force-pushed the perf-reuse-js-instrance-between-compilation branch from 2ada3ac to d91b121 Compare February 13, 2025 06:15
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Feb 17, 2025

CodSpeed Performance Report

Merging #9265 will create unknown performance changes

Comparing perf-reuse-js-instrance-between-compilation (266daa5) with main (fd5c313)

Summary

🆕 7 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 basic N/A 2.5 ms N/A
🆕 basic_sourcemap N/A 2.8 ms N/A
🆕 build_chunk_graph N/A 93 ms N/A
🆕 build_chunk_graph_parallel N/A 72.4 ms N/A
🆕 Traverse compilation.modules N/A 93.6 µs N/A
🆕 Traverse module graph by connections N/A 361.4 µs N/A
🆕 Traverse module graph by dependencies N/A 1.5 ms N/A

@SyMind SyMind force-pushed the perf-reuse-js-instrance-between-compilation branch from 0115850 to e409881 Compare February 17, 2025 03:24
@SyMind SyMind changed the title perf: reuse js instrance between compilation perf: reuse js module between compilation Feb 17, 2025
@SyMind SyMind marked this pull request as ready for review February 17, 2025 09:25
@SyMind SyMind requested a review from jerrykingxyz as a code owner February 17, 2025 09:25
@SyMind SyMind force-pushed the perf-reuse-js-instrance-between-compilation branch from 7e15ba5 to 9604ebe Compare February 17, 2025 10:13
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 17, 2025

📝 Benchmark detail: Open

Name Base (2025-02-17 85a3aba) Current Change
10000_big_production-mode_disable-minimize + exec 38.9 s ± 489 ms 40.5 s ± 1.06 s +4.05 %
10000_development-mode + exec 1.87 s ± 17 ms 1.85 s ± 21 ms -0.86 %
10000_development-mode_hmr + exec 704 ms ± 13 ms 696 ms ± 5.9 ms -1.15 %
10000_production-mode + exec 2.41 s ± 87 ms 2.4 s ± 35 ms -0.76 %
10000_production-mode_persistent-cold + exec 2.55 s ± 84 ms 2.57 s ± 32 ms +0.83 %
10000_production-mode_persistent-hot + exec 1.73 s ± 46 ms 1.76 s ± 73 ms +1.41 %
arco-pro_development-mode + exec 1.81 s ± 149 ms 1.82 s ± 260 ms +0.75 %
arco-pro_development-mode_hmr + exec 391 ms ± 0.83 ms 390 ms ± 4.3 ms -0.38 %
arco-pro_production-mode + exec 3.75 s ± 103 ms 3.73 s ± 324 ms -0.69 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.83 s ± 152 ms 3.81 s ± 187 ms -0.51 %
arco-pro_production-mode_persistent-cold + exec 3.86 s ± 131 ms 3.94 s ± 165 ms +1.97 %
arco-pro_production-mode_persistent-hot + exec 2.51 s ± 206 ms 2.44 s ± 106 ms -2.71 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.72 s ± 186 ms 3.81 s ± 213 ms +2.46 %
large-dyn-imports_development-mode + exec 2.1 s ± 68 ms 2.08 s ± 43 ms -0.92 %
large-dyn-imports_production-mode + exec 2.16 s ± 34 ms 2.15 s ± 35 ms -0.11 %
threejs_development-mode_10x + exec 1.6 s ± 42 ms 1.61 s ± 27 ms +0.53 %
threejs_development-mode_10x_hmr + exec 834 ms ± 28 ms 835 ms ± 22 ms +0.07 %
threejs_production-mode_10x + exec 5.49 s ± 238 ms 5.47 s ± 75 ms -0.39 %
threejs_production-mode_10x_persistent-cold + exec 5.59 s ± 373 ms 5.53 s ± 63 ms -1.11 %
threejs_production-mode_10x_persistent-hot + exec 4.72 s ± 222 ms 4.66 s ± 30 ms -1.16 %
10000_big_production-mode_disable-minimize + rss memory 8689 MiB ± 61.4 MiB 8690 MiB ± 90.2 MiB +0.01 %
10000_development-mode + rss memory 635 MiB ± 26.3 MiB 670 MiB ± 8.12 MiB +5.58 %
10000_development-mode_hmr + rss memory 1283 MiB ± 216 MiB 1179 MiB ± 136 MiB -8.08 %
10000_production-mode + rss memory 616 MiB ± 14.1 MiB 647 MiB ± 21.3 MiB +5.10 %
10000_production-mode_persistent-cold + rss memory 736 MiB ± 6.99 MiB 748 MiB ± 20.3 MiB +1.57 %
10000_production-mode_persistent-hot + rss memory 714 MiB ± 9.4 MiB 722 MiB ± 23.9 MiB +1.11 %
arco-pro_development-mode + rss memory 571 MiB ± 28.2 MiB 571 MiB ± 34.6 MiB +0.03 %
arco-pro_development-mode_hmr + rss memory 658 MiB ± 88.1 MiB 665 MiB ± 64.9 MiB +1.08 %
arco-pro_production-mode + rss memory 729 MiB ± 30.7 MiB 710 MiB ± 23 MiB -2.68 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 728 MiB ± 20.1 MiB 738 MiB ± 45.5 MiB +1.43 %
arco-pro_production-mode_persistent-cold + rss memory 854 MiB ± 16.2 MiB 783 MiB ± 27 MiB -8.24 %
arco-pro_production-mode_persistent-hot + rss memory 718 MiB ± 30.1 MiB 673 MiB ± 15.8 MiB -6.28 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 719 MiB ± 27.4 MiB 724 MiB ± 22.7 MiB +0.74 %
large-dyn-imports_development-mode + rss memory 641 MiB ± 7.68 MiB 647 MiB ± 7 MiB +0.97 %
large-dyn-imports_production-mode + rss memory 522 MiB ± 6.17 MiB 534 MiB ± 7.53 MiB +2.27 %
threejs_development-mode_10x + rss memory 548 MiB ± 15.1 MiB 548 MiB ± 24 MiB -0.10 %
threejs_development-mode_10x_hmr + rss memory 1179 MiB ± 36.7 MiB 1182 MiB ± 113 MiB +0.25 %
threejs_production-mode_10x + rss memory 834 MiB ± 32.9 MiB 834 MiB ± 27.6 MiB +0.01 %
threejs_production-mode_10x_persistent-cold + rss memory 955 MiB ± 69.6 MiB 903 MiB ± 63.2 MiB -5.49 %
threejs_production-mode_10x_persistent-hot + rss memory 862 MiB ± 42.4 MiB 808 MiB ± 47.9 MiB -6.29 %

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Feb 17, 2025

📝 Benchmark detail: Open

Name Base (2025-02-17 85a3aba) Current Change
10000_big_production-mode_disable-minimize + exec 38.9 s ± 489 ms 37.9 s ± 1.07 s -2.58 %
10000_development-mode + exec 1.87 s ± 17 ms 1.74 s ± 25 ms -6.99 %
10000_development-mode_hmr + exec 704 ms ± 13 ms 684 ms ± 30 ms -2.81 %
10000_production-mode + exec 2.41 s ± 87 ms 2.18 s ± 52 ms -9.63 %
10000_production-mode_persistent-cold + exec 2.55 s ± 84 ms 2.32 s ± 63 ms -8.87 %
10000_production-mode_persistent-hot + exec 1.73 s ± 46 ms 1.64 s ± 181 ms -5.24 %
arco-pro_development-mode + exec 1.81 s ± 149 ms 1.74 s ± 83 ms -3.58 %
arco-pro_development-mode_hmr + exec 391 ms ± 0.83 ms 386 ms ± 3.7 ms -1.49 %
arco-pro_production-mode + exec 3.75 s ± 103 ms 3.71 s ± 153 ms -1.15 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.83 s ± 152 ms 3.68 s ± 306 ms -3.87 %
arco-pro_production-mode_persistent-cold + exec 3.86 s ± 131 ms 3.73 s ± 124 ms -3.49 %
arco-pro_production-mode_persistent-hot + exec 2.51 s ± 206 ms 2.3 s ± 117 ms -8.31 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.72 s ± 186 ms 3.6 s ± 208 ms -3.28 %
large-dyn-imports_development-mode + exec 2.1 s ± 68 ms 1.98 s ± 32 ms -6.13 %
large-dyn-imports_production-mode + exec 2.16 s ± 34 ms 2.04 s ± 64 ms -5.12 %
threejs_development-mode_10x + exec 1.6 s ± 42 ms 1.52 s ± 24 ms -4.57 %
threejs_development-mode_10x_hmr + exec 834 ms ± 28 ms 788 ms ± 19 ms -5.61 %
threejs_production-mode_10x + exec 5.49 s ± 238 ms 5.16 s ± 174 ms -5.96 %
threejs_production-mode_10x_persistent-cold + exec 5.59 s ± 373 ms 5.27 s ± 327 ms -5.77 %
threejs_production-mode_10x_persistent-hot + exec 4.72 s ± 222 ms 4.39 s ± 44 ms -6.96 %
10000_big_production-mode_disable-minimize + rss memory 8689 MiB ± 61.4 MiB 8722 MiB ± 47.8 MiB +0.38 %
10000_development-mode + rss memory 635 MiB ± 26.3 MiB 687 MiB ± 20.7 MiB +8.27 %
10000_development-mode_hmr + rss memory 1283 MiB ± 216 MiB 1325 MiB ± 279 MiB +3.28 %
10000_production-mode + rss memory 616 MiB ± 14.1 MiB 671 MiB ± 35.8 MiB +9.02 %
10000_production-mode_persistent-cold + rss memory 736 MiB ± 6.99 MiB 768 MiB ± 32.9 MiB +4.30 %
10000_production-mode_persistent-hot + rss memory 714 MiB ± 9.4 MiB 733 MiB ± 16.5 MiB +2.68 %
arco-pro_development-mode + rss memory 571 MiB ± 28.2 MiB 602 MiB ± 25.9 MiB +5.46 %
arco-pro_development-mode_hmr + rss memory 658 MiB ± 88.1 MiB 696 MiB ± 55.1 MiB +5.71 %
arco-pro_production-mode + rss memory 729 MiB ± 30.7 MiB 757 MiB ± 33.8 MiB +3.76 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 728 MiB ± 20.1 MiB 749 MiB ± 22.3 MiB +2.93 %
arco-pro_production-mode_persistent-cold + rss memory 854 MiB ± 16.2 MiB 831 MiB ± 22.9 MiB -2.65 %
arco-pro_production-mode_persistent-hot + rss memory 718 MiB ± 30.1 MiB 717 MiB ± 40.9 MiB -0.06 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 719 MiB ± 27.4 MiB 736 MiB ± 4.62 MiB +2.33 %
large-dyn-imports_development-mode + rss memory 641 MiB ± 7.68 MiB 663 MiB ± 7.06 MiB +3.40 %
large-dyn-imports_production-mode + rss memory 522 MiB ± 6.17 MiB 551 MiB ± 7.12 MiB +5.69 %
threejs_development-mode_10x + rss memory 548 MiB ± 15.1 MiB 563 MiB ± 9.56 MiB +2.65 %
threejs_development-mode_10x_hmr + rss memory 1179 MiB ± 36.7 MiB 1165 MiB ± 34.6 MiB -1.17 %
threejs_production-mode_10x + rss memory 834 MiB ± 32.9 MiB 853 MiB ± 32.3 MiB +2.23 %
threejs_production-mode_10x_persistent-cold + rss memory 955 MiB ± 69.6 MiB 902 MiB ± 56.6 MiB -5.60 %
threejs_production-mode_10x_persistent-hot + rss memory 862 MiB ± 42.4 MiB 802 MiB ± 51.3 MiB -6.96 %

@SyMind SyMind merged commit ae99d36 into main Feb 17, 2025
38 checks passed
@SyMind SyMind deleted the perf-reuse-js-instrance-between-compilation branch February 17, 2025 12:16
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) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants