Skip to content

Commit 85bb238

Browse files
authored
perf: enable xxhash64 hash function by default (#8249)
* perf: enable `xxhash64` hash function by default * fix: hashDigestLength * fix * fix * fix * fix * fix * fix
1 parent ef40355 commit 85bb238

File tree

43 files changed

+272
-289
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+272
-289
lines changed

packages/rspack-test-tools/tests/__snapshots__/Config.test.js.snap

Lines changed: 98 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
exports[`config config/builtin-lightningcss-loader/basic-include exported tests should transform css correct 1`] = `
44
body {
5-
& ._-ca56f23580d7bbb484-used {
5+
& ._-ec1c834ac8cc99e-used {
66
color: #00f;
77
}
88
}
99
10-
head{--webpack--909:used:_-ca56f23580d7bē484-ĀĂ/&_368;}
10+
head{--webpack--909:used:_-ec1c834aĊcc99e-ĀĂ/&_368;}
1111
`;
1212

1313
exports[`config config/builtin-lightningcss-loader/minify exported tests css content minifyed 1`] = `
@@ -17,96 +17,96 @@ head{--webpack--909:&_487;}
1717

1818
exports[`config config/builtins/css-auto exported tests css/auto can handle css module correctly 1`] = `
1919
Object {
20-
style: -ca56f23580d7bbb484-style,
20+
style: -ec1c834ac8cc99e-style,
2121
}
2222
`;
2323

2424
exports[`config config/builtins/css-modules-composes exported tests css modules composes 1`] = `
2525
Object {
26-
simple-bar: -a7200a43b5c2530b1414-simple-bar -f27007fff641a72c371d-imported-simple,
27-
simple-foo: -a7200a43b5c2530b1414-simple-foo -f27007fff641a72c371d-imported-simple,
26+
simple-bar: -bd00b1e0e0954270-simple-bar -e631de715f468814-imported-simple,
27+
simple-foo: -bd00b1e0e0954270-simple-foo -e631de715f468814-imported-simple,
2828
}
2929
`;
3030

3131
exports[`config config/builtins/css-modules-composes-preprocessers exported tests css modules with css preprocessers 1`] = `
3232
Object {
33-
class: -a7200a43b5c2530b1414-class -feb80f2fe6d30-lessClass,
34-
ghi: -a7200a43b5c2530b1414-ghi,
35-
other: -a7200a43b5c2530b1414-other -ebd90a48d100efd-scssClass,
36-
otherClassName: -a7200a43b5c2530b1414-otherClassName globalClassName,
33+
class: -bd00b1e0e0954270-class -a700d75440d0c95b-lessClass,
34+
ghi: -bd00b1e0e0954270-ghi,
35+
other: -bd00b1e0e0954270-other -c82bab3b83825a-scssClass,
36+
otherClassName: -bd00b1e0e0954270-otherClassName globalClassName,
3737
}
3838
`;
3939
4040
exports[`config config/builtins/css-modules-composes-sass exported tests css modules in scss 1`] = `
4141
Object {
42-
bar: -f1f00e6e62b9a7fadb02-bar -a3b1929b59eeacf15a4-foo,
42+
bar: -f71ebaec3a61562-bar -d2e32b33f9cd5760-foo,
4343
}
4444
`;
4545
4646
exports[`config config/builtins/css-modules-dedupe exported tests css modules dedupe 1`] = `
4747
Object {
48-
backButton: -baa5c4d806a1671b-backButton -e683a459bd7b289e1b8d-secondaryButton -d8686a334ddc6bdd0-button,
49-
nextButton: -baa5c4d806a1671b-nextButton -a510fa2734ece860e70-primaryButton -d8686a334ddc6bdd0-button,
48+
backButton: -f9dde4a2b9fd39e-backButton -c0cdf795e5ee8e4-secondaryButton -ff2973456bd9e-button,
49+
nextButton: -f9dde4a2b9fd39e-nextButton -fe530a949364eca-primaryButton -ff2973456bd9e-button,
5050
}
5151
`;
5252
5353
exports[`config config/builtins/css-modules-exports-only exported tests css modules exportsOnly 1`] = `
5454
Object {
55-
simple-bar: -a7200a43b5c2530b1414-simple-bar -f27007fff641a72c371d-imported-simple,
56-
simple-foo: -a7200a43b5c2530b1414-simple-foo -f27007fff641a72c371d-imported-simple,
55+
simple-bar: -bd00b1e0e0954270-simple-bar -e631de715f468814-imported-simple,
56+
simple-foo: -bd00b1e0e0954270-simple-foo -e631de715f468814-imported-simple,
5757
}
5858
`;
5959
6060
exports[`config config/builtins/css-modules-local-ident-name-hash exported tests css modules localIdentName with hash 1`] = `
6161
Object {
62-
#: ccc05d01b5ed91e5a4d,
63-
##: c16d3dd30b7cca2d412d,
64-
#.#.#: c6e8935740a6209cd48e,
65-
#fake-id: c053ba4f7badbc242,
66-
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.: f5775dd999dc95dd350,
67-
-a-b-c-: e171381fc62026ffe05b,
68-
-a0-34a___f: e6419db424263d77191e,
69-
.: b1061101d3ff1517822,
70-
123: c6f16686ef1ceab9728,
71-
1a2b3c: ea6ff32ba4e9ad9e4c71,
72-
:): c8ad14da9eacd8206f95,
73-
:\`(: ab034bce3407ac44d,
74-
:hover: d64a685363ea14300,
75-
:hover:focus:active: f1ba6ba717fdcfbecc52,
76-
<><<<>><>: a8471bf6e63738086bfa,
77-
<p>: f4a8269a3b7c6f38759d,
78-
?: d4a79a8d3ea0285a,
79-
@: dba948edd127566bb,
80-
B&W?: d26b7b08b3ee0fec8093,
81-
[attr=value]: cf98e323da83a7ef1,
82-
_: b21bb2384964fa8226c0,
83-
_test: acd3c0528ed3c3330,
84-
className: a20f38af3e2122251,
85-
f!o!o: a4a2e3c31408bb709fb,
86-
f'o'o: c1712d83c24d5b7bd9d,
87-
f*o*o: f5ce693ef2ea116b05,
88-
f+o+o: e3714c708c213b9e,
89-
f/o/o: cd9b24dbefa12afeaba5,
90-
f/o/o: f90fa90fb52121fce923,
91-
foo.bar: a7554930d53d1d95676,
92-
foo/bar: e21d87979464d92960b9,
93-
foo/bar/baz: e26519aba0f8e105eb13,
94-
foo/bar: f93c23331183aeac60,
95-
foo/bar/baz: aa79627c6f36d0c8f9,
96-
f~o~o: f4c89337b4a84e05,
97-
m_x_@: f106c601eea0160783bb,
98-
someId: f7dad309581ff59a8c1,
99-
subClass: f904cf1d95567c868707,
100-
test: c8e76de9832d60b206c2,
101-
{}: e73bdae84335b77,
102-
©: d4c6ea8dbaf492a7e42e,
103-
“‘’”: d3df6d853c11234b8,
104-
⌘⌥: bbb74fa7684d2b07,
105-
☺☃: d09672ed2a23417fa543,
106-
: f5682d5025ab700972a0,
107-
𝄞♪♩♫♬: b7e928b15b6057d2f8,
108-
💩: bb34b4e107a01390e3fb,
109-
😍: e5439193d7906536aeac,
62+
#: c36b985d54c6917,
63+
##: ab513cc8abd7e7d,
64+
#.#.#: b6aa9e623eb8be,
65+
#fake-id: d65fd648c910d0f,
66+
++++++++++[>+++++++>++++++++++>+++>+<<<<-]>++.>+.+++++++..+++.>++.<<+++++++++++++++.>.+++.------.--------.>+.>.: fe85c4cd33dc7b53,
67+
-a-b-c-: b1d2002fed1364,
68+
-a0-34a___f: bd6992764ef,
69+
.: f8dc72200543c02,
70+
123: fc54982b169de010,
71+
1a2b3c: e0d288534c575c7c,
72+
:): ce45aa5fbb24,
73+
:\`(: c3a47328b233,
74+
:hover: c9cb40d597d6145,
75+
:hover:focus:active: adb078f8a010,
76+
<><<<>><>: e57bed6057bf,
77+
<p>: d4d795aa031981a3,
78+
?: ca312bbe575926f7,
79+
@: e73735f9a6fa1e2a,
80+
B&W?: c28b11d8276955d9,
81+
[attr=value]: aefb3cf784f22f09,
82+
_: b892aeed406cef6,
83+
_test: f95d7802389a,
84+
className: b88ec9c3ddaa088,
85+
f!o!o: bc20be6f8aa6ba2b,
86+
f'o'o: a1ad39e5bcb2a,
87+
f*o*o: ee490440b4d27dd,
88+
f+o+o: b2f2e8203ab92e0,
89+
f/o/o: e8e6467eba546855,
90+
f/o/o: ac4b388a402f1b,
91+
foo.bar: bf09604a510669,
92+
foo/bar: f06b4ed00041408a,
93+
foo/bar/baz: b62901907350b529,
94+
foo/bar: cf1721b3e29,
95+
foo/bar/baz: db46f3e1d8ecc82b,
96+
f~o~o: e22953bae58b7,
97+
m_x_@: eede355cc6b0366,
98+
someId: f39bfe4a4606a57c,
99+
subClass: dbb85e97d7af8a70,
100+
test: db0a8ac9537cb87c,
101+
{}: c849d7d50310c200,
102+
©: fc4038317,
103+
“‘’”: b1f8cf023766,
104+
⌘⌥: cad802,
105+
☺☃: a5266303d99e4a3,
106+
: b3f2fd830,
107+
𝄞♪♩♫♬: c573deb3b242a81b,
108+
💩: f17b76fb4694950,
109+
😍: d57d2641b441,
110110
}
111111
`;
112112
@@ -165,52 +165,52 @@ Object {
165165
166166
exports[`config config/builtins/css-modules-locals-convention-camelCase exported tests css modules localsConvention with camelCase 1`] = `
167167
Object {
168-
btn--info_is-disabled_1: -a7200a43b5c2530b1414-btn--info_is-disabled_1,
169-
btn-info_is-disabled: -a7200a43b5c2530b1414-btn-info_is-disabled,
170-
btnInfoIsDisabled: -a7200a43b5c2530b1414-btn-info_is-disabled,
171-
btnInfoIsDisabled1: -a7200a43b5c2530b1414-btn--info_is-disabled_1,
172-
fooBar: -a7200a43b5c2530b1414-foo_bar,
173-
foo_bar: -a7200a43b5c2530b1414-foo_bar,
174-
simple: -a7200a43b5c2530b1414-simple,
168+
btn--info_is-disabled_1: -bd00b1e0e0954270-btn--info_is-disabled_1,
169+
btn-info_is-disabled: -bd00b1e0e0954270-btn-info_is-disabled,
170+
btnInfoIsDisabled: -bd00b1e0e0954270-btn-info_is-disabled,
171+
btnInfoIsDisabled1: -bd00b1e0e0954270-btn--info_is-disabled_1,
172+
fooBar: -bd00b1e0e0954270-foo_bar,
173+
foo_bar: -bd00b1e0e0954270-foo_bar,
174+
simple: -bd00b1e0e0954270-simple,
175175
}
176176
`;
177177
178178
exports[`config config/builtins/css-modules-locals-convention-camelCaseOnly exported tests css modules localsConvention with camelCaseOnly 1`] = `
179179
Object {
180-
btnInfoIsDisabled: -a7200a43b5c2530b1414-btn-info_is-disabled,
181-
btnInfoIsDisabled1: -a7200a43b5c2530b1414-btn--info_is-disabled_1,
182-
fooBar: -a7200a43b5c2530b1414-foo_bar,
183-
simple: -a7200a43b5c2530b1414-simple,
180+
btnInfoIsDisabled: -bd00b1e0e0954270-btn-info_is-disabled,
181+
btnInfoIsDisabled1: -bd00b1e0e0954270-btn--info_is-disabled_1,
182+
fooBar: -bd00b1e0e0954270-foo_bar,
183+
simple: -bd00b1e0e0954270-simple,
184184
}
185185
`;
186186
187187
exports[`config config/builtins/css-modules-locals-convention-dashes exported tests css modules localsConvention with dashes 1`] = `
188188
Object {
189-
btn--info_is-disabled_1: -a7200a43b5c2530b1414-btn--info_is-disabled_1,
190-
btn-info-is-disabled: -a7200a43b5c2530b1414-btn-info_is-disabled,
191-
btn-info-is-disabled-1: -a7200a43b5c2530b1414-btn--info_is-disabled_1,
192-
btn-info_is-disabled: -a7200a43b5c2530b1414-btn-info_is-disabled,
193-
foo-bar: -a7200a43b5c2530b1414-foo_bar,
194-
foo_bar: -a7200a43b5c2530b1414-foo_bar,
195-
simple: -a7200a43b5c2530b1414-simple,
189+
btn--info_is-disabled_1: -bd00b1e0e0954270-btn--info_is-disabled_1,
190+
btn-info-is-disabled: -bd00b1e0e0954270-btn-info_is-disabled,
191+
btn-info-is-disabled-1: -bd00b1e0e0954270-btn--info_is-disabled_1,
192+
btn-info_is-disabled: -bd00b1e0e0954270-btn-info_is-disabled,
193+
foo-bar: -bd00b1e0e0954270-foo_bar,
194+
foo_bar: -bd00b1e0e0954270-foo_bar,
195+
simple: -bd00b1e0e0954270-simple,
196196
}
197197
`;
198198
199199
exports[`config config/builtins/css-modules-pseudo exported tests css modules pseudo syntax 1`] = `
200200
Object {
201-
bar: -a7200a43b5c2530b1414-bar,
202-
bav: -a7200a43b5c2530b1414-bav,
203-
foo: -a7200a43b5c2530b1414-foo,
204-
four: -a7200a43b5c2530b1414-four,
205-
one: -a7200a43b5c2530b1414-one,
206-
three: -a7200a43b5c2530b1414-three,
207-
two: -a7200a43b5c2530b1414-two,
201+
bar: -bd00b1e0e0954270-bar,
202+
bav: -bd00b1e0e0954270-bav,
203+
foo: -bd00b1e0e0954270-foo,
204+
four: -bd00b1e0e0954270-four,
205+
one: -bd00b1e0e0954270-one,
206+
three: -bd00b1e0e0954270-three,
207+
two: -bd00b1e0e0954270-two,
208208
}
209209
`;
210210
211211
exports[`config config/builtins/css-modules-simple exported tests css modules simple test 1`] = `
212212
Object {
213-
style: -ca56f23580d7bbb484-style,
213+
style: -ec1c834ac8cc99e-style,
214214
}
215215
`;
216216
@@ -264,17 +264,17 @@ exports[`config config/css/export-selector exported tests should have correct cs
264264
head{--webpack--imported_js:foo:foo/bar:b/ a/ r/local:local/dashName:dashName/&/.//style/.module/.css/?imported;}
265265
`;
266266
267-
exports[`config config/css/rewrite-url exported tests should rewrite the css url() 1`] = `5d8d67b36a3d70a5cea9.png`;
267+
exports[`config config/css/rewrite-url exported tests should rewrite the css url() 1`] = `ac673538c200453e.png`;
268268
269269
exports[`config config/css/rewrite-url exported tests should rewrite the css url() 2`] = `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAOCAYAAAAbvfXsAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAEWSURBVHgBjZFRSsNAEIb/3fQAOUK9gfpe6YIovjU3UE+gJ2g8gTcwXsC+itUFrW+BeAN7ATFSKAjbHWcSC+mSlszLDrvfzvzzj0LHmNpZBtBQd4Gf7fuYgHPPueoCe1DK1UsHd7Dzw+P0daQj/SC5h09OzdGktw221vZXUBlVMN0ILPd6O9yzBBXX8CBdv6kWOGa4YLivQJNjM0ia73oTLsBwJjCB5gu4i7CgbsIey5ThEcOfKziTGFOGHypJeZ7jZ/Gbst4x2/fN9h2eGTNvgk92VrDEWLNmfJXLpIYrRy5b4Fs+9v2/pL0oUncI7FuHLI6PK5lJZGoe8qXNvrry27DesoRLpLPmNkTw9yEcxPWJMR+S/AFbfpAZqxwUNQAAAABJRU5ErkJggg==`;
270270
271-
exports[`config config/css/rewrite-url-css-variables exported tests should rewrite the css url() in css variables 1`] = `5d8d67b36a3d70a5cea9.png`;
271+
exports[`config config/css/rewrite-url-css-variables exported tests should rewrite the css url() in css variables 1`] = `ac673538c200453e.png`;
272272
273-
exports[`config config/css/rewrite-url-css-variables exported tests should rewrite the css url() in css variables 2`] = `5d8d67b36a3d70a5cea9.png`;
273+
exports[`config config/css/rewrite-url-css-variables exported tests should rewrite the css url() in css variables 2`] = `ac673538c200453e.png`;
274274
275-
exports[`config config/css/rewrite-url-with-css-filename exported tests should rewrite the css url() with publicPath and ~@ prefix 1`] = `/image/logo.5d8d67b3.png`;
275+
exports[`config config/css/rewrite-url-with-css-filename exported tests should rewrite the css url() with publicPath and ~@ prefix 1`] = `/image/logo.ac673538.png`;
276276
277-
exports[`config config/css/rewrite-url-with-css-filename exported tests should rewrite the css url() with publicPath when output.cssFilename is set 1`] = `/image/logo.5d8d67b3.png`;
277+
exports[`config config/css/rewrite-url-with-css-filename exported tests should rewrite the css url() with publicPath when output.cssFilename is set 1`] = `/image/logo.ac673538.png`;
278278
279279
exports[`config config/css/urls exported tests css urls should works 1`] = `
280280
/* @supports (background-image: url("unknown.png")) {
@@ -321,7 +321,7 @@ div {
321321
322322
div {
323323
a1: url();
324-
a114: url(09a1a1112c577c279435.png);
324+
a114: url(7bc91c245a8a10a4.png);
325325
}
326326
327327
div {
@@ -716,10 +716,10 @@ exports[`config config/schemes/data-imports exported tests data imports 1`] = `
716716
717717
718718
.class {
719-
a: url(26a611d6d05cbb01eXsvg);
720-
b: url(26a611d6d05cbb01eXsvg);
721-
c: url(26a611d6d05cbb01e459);
722-
d: url(26a611d6d05cbb01e459);
719+
a: url(7159cadb6967ca3cXsvg);
720+
b: url(7159cadb6967ca3cXsvg);
721+
c: url(7159cadb6967ca3c);
722+
d: url(7159cadb6967ca3c);
723723
}
724724
725725
head{--webpack--909:&_653,Ā47ĄĀ645ą_49Ď571;}

packages/rspack-test-tools/tests/__snapshots__/Defaults.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,8 @@ Object {
297297
filename: [name].js,
298298
globalObject: self,
299299
hashDigest: hex,
300-
hashDigestLength: 20,
301-
hashFunction: md4,
300+
hashDigestLength: 16,
301+
hashFunction: xxhash64,
302302
hashSalt: undefined,
303303
hotUpdateChunkFilename: [id].[fullhash].hot-update.js,
304304
hotUpdateGlobal: webpackHotUpdate_rspack_test_tools,

packages/rspack-test-tools/tests/__snapshots__/StatsAPI.test.js.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Object {
4949
main.js,
5050
],
5151
filteredModules: undefined,
52-
hash: ef6849a04b135f983911,
52+
hash: 0d58a78612045381,
5353
id: 909,
5454
idHints: Array [],
5555
initial: true,
@@ -173,7 +173,7 @@ Object {
173173
errorsCount: 0,
174174
filteredAssets: undefined,
175175
filteredModules: undefined,
176-
hash: d27b1f8bbdf2e13f1b91,
176+
hash: 3743948998412d2b,
177177
modules: Array [
178178
Object {
179179
assets: Array [],
@@ -318,7 +318,7 @@ Object {
318318
main.js,
319319
],
320320
filteredModules: undefined,
321-
hash: 83054ce4a0ca18702008,
321+
hash: d6a030a1f9f1c4a3,
322322
id: 909,
323323
idHints: Array [],
324324
initial: true,
@@ -685,7 +685,7 @@ Object {
685685
errorsCount: 0,
686686
filteredAssets: undefined,
687687
filteredModules: undefined,
688-
hash: 16cf99af088168b3b161,
688+
hash: 635581ec6eb08649,
689689
modules: Array [
690690
Object {
691691
assets: Array [],
@@ -1449,7 +1449,7 @@ Object {
14491449
files: Array [
14501450
main.js,
14511451
],
1452-
hash: ef6849a04b135f983911,
1452+
hash: 0d58a78612045381,
14531453
id: 909,
14541454
idHints: Array [],
14551455
initial: true,
@@ -1702,7 +1702,7 @@ Object {
17021702
main.js,
17031703
],
17041704
filteredModules: undefined,
1705-
hash: 770328aa6786a7bd40f1,
1705+
hash: e19af7b5a84caf66,
17061706
id: 909,
17071707
idHints: Array [],
17081708
initial: true,
@@ -2050,7 +2050,7 @@ exports.c = require("./c?c=3");,
20502050
errorsCount: 0,
20512051
filteredAssets: undefined,
20522052
filteredModules: undefined,
2053-
hash: e5c3f8bfb19708a3a81e,
2053+
hash: 1652c7954b2e52cd,
20542054
modules: Array [
20552055
Object {
20562056
assets: Array [],

packages/rspack-test-tools/tests/__snapshots__/StatsOutput.test.js.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
exports[`statsOutput statsOutput/auxiliary-files-test should print correct stats for 1`] = `
44
PublicPath: auto
55
asset bundle.js 2.6 KiB {909} [emitted] (name: main)
6-
asset 2710c5e36f8babb0a3a4.png 7 bytes ({909}) [emitted] [immutable] [from: raw.png] (auxiliary name: main)
7-
Entrypoint main 2.6 KiB (7 bytes) = bundle.js 2.6 KiB (2710c5e36f8babb0a3a4.png 7 bytes)
6+
asset 98396dbfd5c74c34.png 7 bytes ({909}) [emitted] [immutable] [from: raw.png] (auxiliary name: main)
7+
Entrypoint main 2.6 KiB (7 bytes) = bundle.js 2.6 KiB (98396dbfd5c74c34.png 7 bytes)
88
chunk {909} (runtime: main) bundle.js (main) 7 bytes (asset) 159 bytes (javascript) 1.61 KiB (runtime) [entry] [rendered]
99
> ./index main
1010
./index.js + 1 modules [686] 117 bytes {909} [depth 0] [code generated]
@@ -59,7 +59,7 @@ runtime modules 1.61 KiB
5959
[no exports]
6060
[used exports unknown]
6161
62-
Rspack compiled successfully (75a3437c65e54d5331bb)
62+
Rspack compiled successfully (2d43d99dc1ab0913)
6363
`;
6464

6565
exports[`statsOutput statsOutput/builtin-swc-loader-parse-error should print correct stats for 1`] = `

packages/rspack-test-tools/tests/configCases/css-loader/css-modules-classname/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ try {
99
it("css modules classname with default output hash options should works", () => {
1010
const code = fs.readFileSync(__filename, "utf-8");
1111
const name = /"__LOCAL_CLASS_NAME__": [`'"](.*)[`'"]/.exec(code)[1];
12-
expect(name).toEqual("index-module____LOCAL_CLASS_NAME__--b4232134");
12+
expect(name).toEqual("index-module____LOCAL_CLASS_NAME__--dfc99973");
1313
});

0 commit comments

Comments
 (0)