Skip to content

Conversation

@chenjiahan
Copy link
Member

@chenjiahan chenjiahan commented Oct 29, 2024

Summary

  • Enable xxhash64 hash function by default for performance.
  • output.hashDigestLength now defaults to 16, as the hash value generated by the xxhash64 algorithm is up to 16 characters. This can also reduce the bundle size.
  • Rsbuild has been using xxhash64 since v0.1, so this change will not affect Rsbuild.

Benchmark

md4 is slow when building large files, case: https://github.com/hardfist/performance-compare-ng/tree/add-big/apps/10000-big

hyperfine --warmup 1 --runs 3 'HASH_FUNCTION=md4 node --run build:rspack' 'HASH_FUNCTION=xxhash64 node --run build:rspack'
Benchmark 1: HASH_FUNCTION=md4 node --run build:rspack
  Time (mean ± σ):     11.428 s ±  0.758 s    [User: 83.504 s, System: 5.808 s]
  Range (min … max):   10.892 s … 12.295 s    3 runs

Benchmark 2: HASH_FUNCTION=xxhash64 node --run build:rspack
  Time (mean ± σ):      9.697 s ±  0.318 s    [User: 79.664 s, System: 6.127 s]
  Range (min … max):    9.374 s … 10.009 s    3 runs

Summary
  HASH_FUNCTION=xxhash64 node --run build:rspack ran
    1.18 ± 0.09 times faster than HASH_FUNCTION=md4 node --run build:rspack

Related

Checklist

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

@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 Oct 29, 2024
@netlify
Copy link

netlify bot commented Oct 29, 2024

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit fbc9f01
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/6720c0d793667100087f2e33

@chenjiahan chenjiahan merged commit 85bb238 into main Oct 29, 2024
29 checks passed
@chenjiahan chenjiahan deleted the hash_function_1029 branch October 29, 2024 11:31
@chenjiahan
Copy link
Member Author

!bench

@rspack-bot
Copy link

rspack-bot commented Oct 30, 2024

📝 Benchmark detail: Open

Name Base (2024-10-30 85bb238) Current Change
10000_big_production-mode + exec 48.8 s ± 720 ms 52.6 s ± 13.1 s +7.73 %
10000_development-mode + exec 2.11 s ± 43 ms 2.11 s ± 38 ms +0.15 %
10000_development-mode_hmr + exec 647 ms ± 5.9 ms 639 ms ± 6.5 ms -1.22 %
10000_production-mode + exec 2.67 s ± 33 ms 2.69 s ± 27 ms +0.94 %
arco-pro_development-mode + exec 1.77 s ± 81 ms 1.77 s ± 73 ms -0.12 %
arco-pro_development-mode_hmr + exec 428 ms ± 1.8 ms 333 ms ± 53 ms -22.29 %
arco-pro_production-mode + exec 3.18 s ± 73 ms 184 ms ± 4.2 ms -94.23 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.28 s ± 79 ms 228 ms ± 4.1 ms -93.06 %
threejs_development-mode_10x + exec 1.62 s ± 14 ms 1.62 s ± 15 ms +0.09 %
threejs_development-mode_10x_hmr + exec 774 ms ± 5.9 ms 760 ms ± 16 ms -1.82 %
threejs_production-mode_10x + exec 4.99 s ± 19 ms 5.01 s ± 31 ms +0.36 %

Threshold exceeded: ["10000_big_production-mode + exec"]

@SoonIter
Copy link
Member

!bench

@rspack-bot
Copy link

rspack-bot commented Oct 30, 2024

📝 Benchmark detail: Open

Name Base (2024-10-30 85bb238) Current Change
10000_big_production-mode + exec 48.8 s ± 720 ms 51 s ± 6.08 s +4.45 %
10000_development-mode + exec 2.11 s ± 43 ms 2.11 s ± 29 ms +0.08 %
10000_development-mode_hmr + exec 647 ms ± 5.9 ms 636 ms ± 7 ms -1.60 %
10000_production-mode + exec 2.67 s ± 33 ms 2.69 s ± 45 ms +0.90 %
arco-pro_development-mode + exec 1.77 s ± 81 ms 1.79 s ± 87 ms +1.23 %
arco-pro_development-mode_hmr + exec 428 ms ± 1.8 ms 428 ms ± 2.3 ms -0.06 %
arco-pro_production-mode + exec 3.18 s ± 73 ms 3.2 s ± 80 ms +0.56 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.28 s ± 79 ms 3.3 s ± 101 ms +0.63 %
threejs_development-mode_10x + exec 1.62 s ± 14 ms 1.62 s ± 15 ms +0.20 %
threejs_development-mode_10x_hmr + exec 774 ms ± 5.9 ms 769 ms ± 10 ms -0.68 %
threejs_production-mode_10x + exec 4.99 s ± 19 ms 4.99 s ± 27 ms -0.07 %

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.

5 participants