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

refactor(rust): improve replace_all_placeholder #9525

Merged

Conversation

shulaoda
Copy link
Collaborator

@shulaoda shulaoda commented Mar 2, 2025

Summary

Related to #9304

I made some improvements to ensure optimal performance in general cases while achieving a slight performance boost. Additionally, I fixed boundary errors in the [hash:8] case to maintain correctness and ensure consistent performance.

Checklist

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

Copy link

netlify bot commented Mar 2, 2025

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit b6accb2
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67c6ba38fdab580008d39ff9

@shulaoda
Copy link
Collaborator Author

shulaoda commented Mar 2, 2025

!bench

@shulaoda
Copy link
Collaborator Author

shulaoda commented Mar 2, 2025

Could you help me trigger the benchmark after passing the tests? @chenjiahan

Copy link

codspeed-hq bot commented Mar 2, 2025

CodSpeed Performance Report

Merging #9525 will not alter performance

Comparing shulaoda:refactor/improve-replace-all-placeholder (b6accb2) with main (44f96be)

🎉 Hooray! codspeed-rust just leveled up to 2.7.2!

A heads-up, this is a breaking change and it might affect your current performance baseline a bit. But here's the exciting part - it's packed with new, cool features and promises improved result stability 🥳!
Curious about what's new? Visit our releases page to delve into all the awesome details about this new version.

Summary

✅ 7 untouched benchmarks

@shulaoda shulaoda assigned shulaoda and unassigned shulaoda Mar 2, 2025
@shulaoda shulaoda marked this pull request as draft March 2, 2025 15:17
@shulaoda shulaoda marked this pull request as ready for review March 2, 2025 16:12
@shulaoda shulaoda requested a review from h-a-n-a March 2, 2025 17:31
Copy link
Contributor

github-actions bot commented Mar 3, 2025

📝 Benchmark detail: Open

Name Base (2025-03-03 39f2bfb) Current Change
10000_big_production-mode_disable-minimize + exec 36.7 s ± 398 ms 37.6 s ± 1.31 s +2.67 %
10000_development-mode + exec 1.74 s ± 33 ms 1.7 s ± 31 ms -2.40 %
10000_development-mode_hmr + exec 674 ms ± 7.1 ms 677 ms ± 6.5 ms +0.42 %
10000_production-mode + exec 2.19 s ± 34 ms 2.19 s ± 63 ms +0.23 %
10000_production-mode_persistent-cold + exec 2.34 s ± 103 ms 2.37 s ± 178 ms +1.26 %
10000_production-mode_persistent-hot + exec 1.64 s ± 48 ms 1.64 s ± 42 ms -0.21 %
arco-pro_development-mode + exec 1.72 s ± 117 ms 1.74 s ± 110 ms +1.13 %
arco-pro_development-mode_hmr + exec 375 ms ± 2.3 ms 377 ms ± 2.1 ms +0.57 %
arco-pro_production-mode + exec 3.53 s ± 130 ms 3.47 s ± 110 ms -1.65 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.55 s ± 92 ms 3.5 s ± 121 ms -1.28 %
arco-pro_production-mode_persistent-cold + exec 3.61 s ± 160 ms 3.58 s ± 22 ms -0.94 %
arco-pro_production-mode_persistent-hot + exec 2.25 s ± 96 ms 2.36 s ± 173 ms +4.93 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.59 s ± 188 ms 3.51 s ± 107 ms -2.35 %
large-dyn-imports_development-mode + exec 1.97 s ± 35 ms 1.97 s ± 43 ms -0.10 %
large-dyn-imports_production-mode + exec 2.02 s ± 28 ms 2.07 s ± 58 ms +2.14 %
threejs_development-mode_10x + exec 1.44 s ± 27 ms 1.43 s ± 30 ms -0.74 %
threejs_development-mode_10x_hmr + exec 787 ms ± 19 ms 784 ms ± 17 ms -0.46 %
threejs_production-mode_10x + exec 5.1 s ± 181 ms 5.04 s ± 93 ms -1.02 %
threejs_production-mode_10x_persistent-cold + exec 5.17 s ± 474 ms 5.1 s ± 44 ms -1.40 %
threejs_production-mode_10x_persistent-hot + exec 4.47 s ± 294 ms 4.41 s ± 82 ms -1.31 %
10000_big_production-mode_disable-minimize + rss memory 8667 MiB ± 43.4 MiB 8671 MiB ± 33.6 MiB +0.05 %
10000_development-mode + rss memory 662 MiB ± 22.8 MiB 652 MiB ± 19.2 MiB -1.50 %
10000_development-mode_hmr + rss memory 1237 MiB ± 297 MiB 1223 MiB ± 293 MiB -1.19 %
10000_production-mode + rss memory 626 MiB ± 32.8 MiB 633 MiB ± 22.6 MiB +1.08 %
10000_production-mode_persistent-cold + rss memory 737 MiB ± 31.9 MiB 742 MiB ± 11.9 MiB +0.76 %
10000_production-mode_persistent-hot + rss memory 703 MiB ± 15.7 MiB 720 MiB ± 27.1 MiB +2.41 %
arco-pro_development-mode + rss memory 569 MiB ± 32.9 MiB 580 MiB ± 27.6 MiB +1.92 %
arco-pro_development-mode_hmr + rss memory 630 MiB ± 25.6 MiB 665 MiB ± 51.1 MiB +5.54 %
arco-pro_production-mode + rss memory 706 MiB ± 48 MiB 704 MiB ± 42.3 MiB -0.24 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 719 MiB ± 22 MiB 718 MiB ± 23.2 MiB -0.26 %
arco-pro_production-mode_persistent-cold + rss memory 792 MiB ± 18.4 MiB 775 MiB ± 32.4 MiB -2.18 %
arco-pro_production-mode_persistent-hot + rss memory 643 MiB ± 19.1 MiB 641 MiB ± 25.7 MiB -0.25 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 715 MiB ± 26.3 MiB 701 MiB ± 25.7 MiB -2.01 %
large-dyn-imports_development-mode + rss memory 653 MiB ± 9.69 MiB 653 MiB ± 5.3 MiB -0.06 %
large-dyn-imports_production-mode + rss memory 533 MiB ± 3.98 MiB 533 MiB ± 1.6 MiB +0.06 %
threejs_development-mode_10x + rss memory 559 MiB ± 39.5 MiB 558 MiB ± 15.8 MiB -0.11 %
threejs_development-mode_10x_hmr + rss memory 985 MiB ± 287 MiB 906 MiB ± 360 MiB -8.00 %
threejs_production-mode_10x + rss memory 831 MiB ± 58.5 MiB 842 MiB ± 52.5 MiB +1.31 %
threejs_production-mode_10x_persistent-cold + rss memory 966 MiB ± 72.2 MiB 943 MiB ± 68.2 MiB -2.40 %
threejs_production-mode_10x_persistent-hot + rss memory 811 MiB ± 41.5 MiB 816 MiB ± 54.7 MiB +0.66 %

@chenjiahan
Copy link
Member

Benchmark triggered 😄

@shulaoda shulaoda force-pushed the refactor/improve-replace-all-placeholder branch from 140c945 to 0e6133f Compare March 3, 2025 21:53

This comment was marked as outdated.

@h-a-n-a h-a-n-a force-pushed the refactor/improve-replace-all-placeholder branch from 0e6133f to b6accb2 Compare March 4, 2025 08:30
Copy link
Contributor

github-actions bot commented Mar 4, 2025

📝 Benchmark detail: Open

Name Base (2025-03-04 ec71bd0) Current Change
10000_big_production-mode_disable-minimize + exec 36.7 s ± 403 ms 36.5 s ± 883 ms -0.69 %
10000_development-mode + exec 1.71 s ± 20 ms 1.67 s ± 24 ms -2.55 %
10000_development-mode_hmr + exec 681 ms ± 18 ms 664 ms ± 7.3 ms -2.62 %
10000_production-mode + exec 2.21 s ± 117 ms 2.1 s ± 77 ms -5.02 %
10000_production-mode_persistent-cold + exec 2.33 s ± 50 ms 2.23 s ± 26 ms -4.52 %
10000_production-mode_persistent-hot + exec 1.64 s ± 26 ms 1.56 s ± 71 ms -4.99 %
arco-pro_development-mode + exec 1.73 s ± 128 ms 1.73 s ± 104 ms -0.13 %
arco-pro_development-mode_hmr + exec 375 ms ± 1.9 ms 375 ms ± 3.5 ms +0.13 %
arco-pro_production-mode + exec 3.54 s ± 113 ms 3.45 s ± 162 ms -2.74 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.58 s ± 191 ms 3.49 s ± 130 ms -2.72 %
arco-pro_production-mode_persistent-cold + exec 3.56 s ± 148 ms 3.51 s ± 150 ms -1.50 %
arco-pro_production-mode_persistent-hot + exec 2.25 s ± 115 ms 2.29 s ± 124 ms +1.71 %
arco-pro_production-mode_traverse-chunk-modules + exec 3.53 s ± 177 ms 3.46 s ± 166 ms -1.76 %
large-dyn-imports_development-mode + exec 1.95 s ± 58 ms 1.92 s ± 54 ms -1.77 %
large-dyn-imports_production-mode + exec 2 s ± 57 ms 1.97 s ± 49 ms -1.39 %
threejs_development-mode_10x + exec 1.43 s ± 35 ms 1.47 s ± 102 ms +2.23 %
threejs_development-mode_10x_hmr + exec 786 ms ± 10 ms 786 ms ± 24 ms +0.04 %
threejs_production-mode_10x + exec 5.03 s ± 77 ms 4.95 s ± 335 ms -1.50 %
threejs_production-mode_10x_persistent-cold + exec 5.13 s ± 357 ms 5.03 s ± 112 ms -1.91 %
threejs_production-mode_10x_persistent-hot + exec 4.47 s ± 335 ms 4.33 s ± 298 ms -3.04 %
10000_big_production-mode_disable-minimize + rss memory 8698 MiB ± 78.5 MiB 9543 MiB ± 488 MiB +9.71 %
10000_development-mode + rss memory 678 MiB ± 11.8 MiB 682 MiB ± 55.2 MiB +0.66 %
10000_development-mode_hmr + rss memory 1247 MiB ± 285 MiB 1465 MiB ± 328 MiB +17.50 %
10000_production-mode + rss memory 650 MiB ± 26.5 MiB 693 MiB ± 24.9 MiB +6.60 %
10000_production-mode_persistent-cold + rss memory 762 MiB ± 20 MiB 807 MiB ± 44.2 MiB +5.89 %
10000_production-mode_persistent-hot + rss memory 735 MiB ± 11.5 MiB 742 MiB ± 23.6 MiB +0.97 %
arco-pro_development-mode + rss memory 636 MiB ± 21.9 MiB 587 MiB ± 29.1 MiB -7.67 %
arco-pro_development-mode_hmr + rss memory 709 MiB ± 21.4 MiB 641 MiB ± 59.7 MiB -9.57 %
arco-pro_production-mode + rss memory 776 MiB ± 38.8 MiB 743 MiB ± 94 MiB -4.21 %
arco-pro_production-mode_generate-package-json-webpack-plugin + rss memory 792 MiB ± 25.6 MiB 760 MiB ± 96.8 MiB -4.03 %
arco-pro_production-mode_persistent-cold + rss memory 863 MiB ± 20.6 MiB 804 MiB ± 60.7 MiB -6.82 %
arco-pro_production-mode_persistent-hot + rss memory 832 MiB ± 32 MiB 806 MiB ± 66.4 MiB -3.13 %
arco-pro_production-mode_traverse-chunk-modules + rss memory 800 MiB ± 35.8 MiB 753 MiB ± 95.3 MiB -5.88 %
large-dyn-imports_development-mode + rss memory 697 MiB ± 17 MiB 671 MiB ± 9.12 MiB -3.79 %
large-dyn-imports_production-mode + rss memory 576 MiB ± 3.62 MiB 561 MiB ± 6.35 MiB -2.53 %
threejs_development-mode_10x + rss memory 651 MiB ± 59.5 MiB 677 MiB ± 47.8 MiB +4.08 %
threejs_development-mode_10x_hmr + rss memory 974 MiB ± 301 MiB 951 MiB ± 354 MiB -2.41 %
threejs_production-mode_10x + rss memory 919 MiB ± 56.1 MiB 966 MiB ± 104 MiB +5.06 %
threejs_production-mode_10x_persistent-cold + rss memory 1050 MiB ± 71.5 MiB 1081 MiB ± 41 MiB +2.96 %
threejs_production-mode_10x_persistent-hot + rss memory 916 MiB ± 60.7 MiB 888 MiB ± 62.3 MiB -3.02 %

Copy link
Contributor

@h-a-n-a h-a-n-a left a comment

Choose a reason for hiding this comment

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

Thanks!

@h-a-n-a h-a-n-a merged commit b35bf32 into web-infra-dev:main Mar 4, 2025
27 checks passed
@shulaoda shulaoda deleted the refactor/improve-replace-all-placeholder branch March 4, 2025 11:08
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.

None yet

3 participants