Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(es/minifier): Inline pure array literal partially (#6099)
- Loading branch information
Showing
24 changed files
with
119 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 0 additions & 6 deletions
6
crates/swc/tests/tsc-references/conditionalOperatorConditionIsNumberType.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1 @@ | ||
//// [conditionalOperatorConditionIsNumberType.ts] | ||
var array = [ | ||
1, | ||
2, | ||
3 | ||
]; | ||
array[1], array[1], array[1]; |
8 changes: 2 additions & 6 deletions
8
crates/swc/tests/tsc-references/conditionalOperatorConditoinIsStringType.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,7 @@ | ||
//// [conditionalOperatorConditoinIsStringType.ts] | ||
var condString; | ||
import _type_of from "@swc/helpers/src/_type_of.mjs"; | ||
function foo() { | ||
return "string"; | ||
} | ||
var condString, array = [ | ||
"1", | ||
"2", | ||
"3" | ||
]; | ||
void 0 === condString || _type_of(condString), condString.toUpperCase, foo(), array[1], foo(), void 0 === condString || _type_of(condString), condString.toUpperCase, foo(), array[1], void 0 === condString || _type_of(condString), condString.toUpperCase; | ||
void 0 === condString || _type_of(condString), condString.toUpperCase, foo(), foo(), void 0 === condString || _type_of(condString), condString.toUpperCase, foo(), void 0 === condString || _type_of(condString), condString.toUpperCase; |
20 changes: 10 additions & 10 deletions
20
crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment2.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
//// [destructuringArrayBindingPatternAndAssignment2.ts] | ||
import _sliced_to_array from "@swc/helpers/src/_sliced_to_array.mjs"; | ||
import _to_consumable_array from "@swc/helpers/src/_to_consumable_array.mjs"; | ||
var ref = [], ref1 = (_sliced_to_array(ref[0], 1)[0], _sliced_to_array(ref[1], 1)); | ||
var ref = (_sliced_to_array([][0], 1)[0], _sliced_to_array([][1], 1)); | ||
_sliced_to_array(ref[0], 1)[0]; | ||
var _undefined = _sliced_to_array(void 0, 2), ref1 = (_sliced_to_array(_undefined[0], 1)[0], _sliced_to_array(_undefined[1], 1)); | ||
_sliced_to_array(ref1[0], 1)[0]; | ||
var _undefined = _sliced_to_array(void 0, 2), ref2 = (_sliced_to_array(_undefined[0], 1)[0], _sliced_to_array(_undefined[1], 1)); | ||
_sliced_to_array(ref2[0], 1)[0]; | ||
var ref3 = _sliced_to_array([ | ||
var ref2 = _sliced_to_array([ | ||
1, | ||
2, | ||
3 | ||
], 3); | ||
ref3[0], ref3[1], ref3[2]; | ||
ref2[0], ref2[1], ref2[2]; | ||
var temp = [ | ||
1, | ||
2, | ||
3 | ||
], ref4 = _sliced_to_array(_to_consumable_array(temp), 2); | ||
], ref3 = _sliced_to_array(_to_consumable_array(temp), 2); | ||
ref3[0], ref3[1]; | ||
var ref4 = _sliced_to_array(_to_consumable_array(temp), 2); | ||
ref4[0], ref4[1]; | ||
var ref5 = _sliced_to_array(_to_consumable_array(temp), 2); | ||
ref5[0], ref5[1]; | ||
var ref6 = _sliced_to_array({ | ||
var ref5 = _sliced_to_array({ | ||
2: !0 | ||
}, 3); | ||
ref6[0], ref6[1], ref6[2]; | ||
ref5[0], ref5[1], ref5[2]; |
12 changes: 3 additions & 9 deletions
12
crates/swc/tests/tsc-references/destructuringArrayBindingPatternAndAssignment3.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
crates/swc/tests/tsc-references/destructuringControlFlow.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
//// [destructuringControlFlow.ts] | ||
var ref = [ | ||
(0, [ | ||
"foo" | ||
]; | ||
(ref[0], ref[1]).toUpperCase(); | ||
][1]).toUpperCase(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
crates/swc/tests/tsc-references/typeInferenceWithTupleType.2.minified.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
66196a6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Benchmark
es/full/minify/libraries/antd
1841640549
ns/iter (± 41840828
)1750422067
ns/iter (± 58487204
)1.05
es/full/minify/libraries/d3
389664519
ns/iter (± 24714000
)370949220
ns/iter (± 28859221
)1.05
es/full/minify/libraries/echarts
1426277893
ns/iter (± 98973466
)1349211554
ns/iter (± 40923464
)1.06
es/full/minify/libraries/jquery
104245284
ns/iter (± 7491499
)84487445
ns/iter (± 2366396
)1.23
es/full/minify/libraries/lodash
117558002
ns/iter (± 14531090
)95172666
ns/iter (± 2282393
)1.24
es/full/minify/libraries/moment
54521441
ns/iter (± 3633033
)50107421
ns/iter (± 808699
)1.09
es/full/minify/libraries/react
21008694
ns/iter (± 2057482
)17531787
ns/iter (± 530550
)1.20
es/full/minify/libraries/terser
312194308
ns/iter (± 8065551
)268990172
ns/iter (± 20137024
)1.16
es/full/minify/libraries/three
546550779
ns/iter (± 8327970
)486088546
ns/iter (± 14764534
)1.12
es/full/minify/libraries/typescript
3223708704
ns/iter (± 121689548
)3251334183
ns/iter (± 87930567
)0.99
es/full/minify/libraries/victory
785126384
ns/iter (± 13825658
)777413276
ns/iter (± 30073884
)1.01
es/full/minify/libraries/vue
146274976
ns/iter (± 12902788
)141311679
ns/iter (± 7455873
)1.04
es/full/codegen/es3
36315
ns/iter (± 4210
)34549
ns/iter (± 3586
)1.05
es/full/codegen/es5
35378
ns/iter (± 1811
)34033
ns/iter (± 1732
)1.04
es/full/codegen/es2015
34788
ns/iter (± 1508
)34395
ns/iter (± 904
)1.01
es/full/codegen/es2016
35137
ns/iter (± 1347
)35511
ns/iter (± 4764
)0.99
es/full/codegen/es2017
35512
ns/iter (± 3347
)34441
ns/iter (± 4069
)1.03
es/full/codegen/es2018
35277
ns/iter (± 3084
)34423
ns/iter (± 2399
)1.02
es/full/codegen/es2019
34740
ns/iter (± 1929
)34829
ns/iter (± 3117
)1.00
es/full/codegen/es2020
34868
ns/iter (± 2918
)34033
ns/iter (± 3492
)1.02
es/full/all/es3
234670572
ns/iter (± 20030602
)208791636
ns/iter (± 33755395
)1.12
es/full/all/es5
219644343
ns/iter (± 21161775
)190898736
ns/iter (± 16497226
)1.15
es/full/all/es2015
178679364
ns/iter (± 18021872
)169263450
ns/iter (± 19095085
)1.06
es/full/all/es2016
181711050
ns/iter (± 17808286
)172705126
ns/iter (± 19937958
)1.05
es/full/all/es2017
168858909
ns/iter (± 16892528
)147651273
ns/iter (± 8238689
)1.14
es/full/all/es2018
160223905
ns/iter (± 14409721
)148204267
ns/iter (± 9228689
)1.08
es/full/all/es2019
157448019
ns/iter (± 15273834
)153042850
ns/iter (± 9141838
)1.03
es/full/all/es2020
170758461
ns/iter (± 15970447
)150023391
ns/iter (± 14947060
)1.14
es/full/parser
776783
ns/iter (± 46322
)771167
ns/iter (± 111263
)1.01
es/full/base/fixer
28072
ns/iter (± 4185
)27561
ns/iter (± 1292
)1.02
es/full/base/resolver_and_hygiene
98243
ns/iter (± 6311
)96064
ns/iter (± 6058
)1.02
serialization of ast node
232
ns/iter (± 16
)218
ns/iter (± 3
)1.06
serialization of serde
238
ns/iter (± 5
)224
ns/iter (± 7
)1.06
This comment was automatically generated by workflow using github-action-benchmark.