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): Respect options (#6245)
- Loading branch information
Showing
11 changed files
with
21 additions
and
14 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
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
3 changes: 2 additions & 1 deletion
3
crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/may_throw_2/output.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,8 @@ | ||
function f(b) { | ||
try { | ||
var a = x(); | ||
return (++b)(a); | ||
++b; | ||
return b(a); | ||
} catch (e) {} | ||
console.log(b); | ||
} | ||
|
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/terser/compress/collapse_vars/reduce_vars_assign/output.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,4 +1,4 @@ | ||
!function() { | ||
var a = 1; | ||
a = 0, console.log(a); | ||
console.log(a = 0); | ||
}(); |
3 changes: 1 addition & 2 deletions
3
crates/swc_ecma_minifier/tests/terser/compress/drop_unused/assign_binding/output.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,4 +1,3 @@ | ||
function f() { | ||
var a; | ||
a = f.g, a(); | ||
(0, f.g)(); | ||
} |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/terser/compress/issue_281/drop_fargs/output.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,3 +1,3 @@ | ||
var a = 1; | ||
++a && a.var, a++; | ||
a++, a && a.var, a++; | ||
console.log(a); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/terser/compress/issue_281/keep_fargs/output.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,3 +1,3 @@ | ||
var a = 1; | ||
++a && a.var, a++; | ||
a++, a && a.var, a++; | ||
console.log(a); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/terser/compress/sequences/func_def_1/output.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,4 +1,4 @@ | ||
function f() { | ||
return f = 0, !!f; | ||
return f = 0, false; | ||
} | ||
console.log(f()); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/terser/compress/sequences/func_def_3/output.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,5 @@ | ||
function f() { | ||
function g() {} | ||
return g = 0, !!g; | ||
return g = 0, false; | ||
} | ||
console.log(f()); |
2 changes: 1 addition & 1 deletion
2
crates/swc_ecma_minifier/tests/terser/compress/sequences/func_def_4/output.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,6 +1,6 @@ | ||
function f() { | ||
function g() { | ||
return (g = 0), !!g; | ||
return g = 0, false; | ||
} | ||
return g(); | ||
} | ||
|
ec9a80a
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/bugs-1
342480
ns/iter (± 21183
)349991
ns/iter (± 47894
)0.98
es/full/minify/libraries/antd
1778038756
ns/iter (± 35742534
)1874742104
ns/iter (± 36667168
)0.95
es/full/minify/libraries/d3
411309029
ns/iter (± 27296554
)416567004
ns/iter (± 9551959
)0.99
es/full/minify/libraries/echarts
1559827556
ns/iter (± 57437820
)1580707007
ns/iter (± 46547020
)0.99
es/full/minify/libraries/jquery
109617453
ns/iter (± 6244540
)108207136
ns/iter (± 5129673
)1.01
es/full/minify/libraries/lodash
120285404
ns/iter (± 4430611
)126550128
ns/iter (± 5208045
)0.95
es/full/minify/libraries/moment
59376352
ns/iter (± 1867611
)62749890
ns/iter (± 2952104
)0.95
es/full/minify/libraries/react
20743422
ns/iter (± 1068385
)21495927
ns/iter (± 655499
)0.96
es/full/minify/libraries/terser
313248753
ns/iter (± 22860402
)326079189
ns/iter (± 14425335
)0.96
es/full/minify/libraries/three
563253786
ns/iter (± 29022925
)563664653
ns/iter (± 16197390
)1.00
es/full/minify/libraries/typescript
3457847686
ns/iter (± 147959439
)3437079594
ns/iter (± 55916060
)1.01
es/full/minify/libraries/victory
828330741
ns/iter (± 16139139
)868763686
ns/iter (± 21250828
)0.95
es/full/minify/libraries/vue
167841152
ns/iter (± 11687848
)176179092
ns/iter (± 3466382
)0.95
es/full/codegen/es3
32958
ns/iter (± 1274
)34278
ns/iter (± 494
)0.96
es/full/codegen/es5
33026
ns/iter (± 11151
)34234
ns/iter (± 312
)0.96
es/full/codegen/es2015
32957
ns/iter (± 687
)34372
ns/iter (± 541
)0.96
es/full/codegen/es2016
33237
ns/iter (± 451
)34309
ns/iter (± 803
)0.97
es/full/codegen/es2017
33141
ns/iter (± 578
)34351
ns/iter (± 823
)0.96
es/full/codegen/es2018
33315
ns/iter (± 1264
)34339
ns/iter (± 1230
)0.97
es/full/codegen/es2019
33287
ns/iter (± 1886
)34345
ns/iter (± 343
)0.97
es/full/codegen/es2020
33244
ns/iter (± 4702
)34274
ns/iter (± 619
)0.97
es/full/all/es3
226900201
ns/iter (± 17953551
)205264773
ns/iter (± 10321129
)1.11
es/full/all/es5
208613106
ns/iter (± 15440946
)192685862
ns/iter (± 8497290
)1.08
es/full/all/es2015
173544619
ns/iter (± 14320808
)152042588
ns/iter (± 5358163
)1.14
es/full/all/es2016
175814657
ns/iter (± 14861203
)149260863
ns/iter (± 6678019
)1.18
es/full/all/es2017
167222530
ns/iter (± 12537183
)149844648
ns/iter (± 5532439
)1.12
es/full/all/es2018
169799874
ns/iter (± 16026691
)147070385
ns/iter (± 3973607
)1.15
es/full/all/es2019
165794757
ns/iter (± 16031431
)145032657
ns/iter (± 4297083
)1.14
es/full/all/es2020
161914468
ns/iter (± 14739498
)137694016
ns/iter (± 4072610
)1.18
es/full/parser
735882
ns/iter (± 36705
)721857
ns/iter (± 18050
)1.02
es/full/base/fixer
27271
ns/iter (± 634
)26308
ns/iter (± 391
)1.04
es/full/base/resolver_and_hygiene
94148
ns/iter (± 5657
)92057
ns/iter (± 3858
)1.02
serialization of ast node
215
ns/iter (± 5
)215
ns/iter (± 4
)1
serialization of serde
219
ns/iter (± 8
)218
ns/iter (± 8
)1.00
This comment was automatically generated by workflow using github-action-benchmark.