Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(html/minifier): Improve removal of redundant attributes (#6197)
- Loading branch information
1 parent
7d5b544
commit aa3fab1
Showing
34 changed files
with
368 additions
and
113 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
4 changes: 2 additions & 2 deletions
4
crates/swc_html_minifier/tests/fixture/attribute/colspan/output.min.html
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
2 changes: 1 addition & 1 deletion
2
crates/swc_html_minifier/tests/fixture/attribute/data/output.min.html
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 +1 @@ | ||
<!doctype html><html lang=en><title>Document</title><input class=form-control id={{vm.formInputName}} name={{vm.formInputName}} placeholder=YYYY-MM-DD date-range-picker data-ng-model=vm.value data-ng-model-options="{ debounce: 1000 }" data-ng-pattern=vm.options.format data-options=vm.datepickerOptions> | ||
<!doctype html><html lang=en><title>Document</title><input class=form-control type=text id={{vm.formInputName}} name={{vm.formInputName}} placeholder=YYYY-MM-DD date-range-picker data-ng-model=vm.value data-ng-model-options="{ debounce: 1000 }" data-ng-pattern=vm.options.format data-options=vm.datepickerOptions> |
3 changes: 0 additions & 3 deletions
3
...wc_html_minifier/tests/fixture/attribute/disabled-remove_redundant_attributes/config.json
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
...swc_html_minifier/tests/fixture/attribute/disabled-remove_redundant_attributes/input.html
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
...tml_minifier/tests/fixture/attribute/disabled-remove_redundant_attributes/output.min.html
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
crates/swc_html_minifier/tests/fixture/attribute/form/output.min.html
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,10 +1,10 @@ | ||
<!doctype html><meta charset=utf-8><title>Test</title><form action=handler.php method=post> | ||
<input name=str> | ||
<input type=text name=str> | ||
<input type=submit value=send> | ||
</form> | ||
<form action=handler.php> | ||
<input name=str> | ||
<form action=handler.php method=get> | ||
<input type=text name=str> | ||
<input type=submit value=send> | ||
<input value=foo> | ||
<input type=text value=foo> | ||
<input type=checkbox> | ||
</form> |
2 changes: 1 addition & 1 deletion
2
crates/swc_html_minifier/tests/fixture/attribute/iframe/output.min.html
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 +1 @@ | ||
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>Document</title><iframe id=test src=test.html></iframe> | ||
<!doctype html><html lang=en><meta charset=UTF-8><meta name=viewport content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0"><meta http-equiv=X-UA-Compatible content="ie=edge"><title>Document</title><iframe id=test src=test.html height=150 width=300 loading=eager fetchpriority=auto referrerpolicy=strict-origin-when-cross-origin></iframe> |
2 changes: 1 addition & 1 deletion
2
crates/swc_html_minifier/tests/fixture/attribute/img/output.min.html
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 +1 @@ | ||
<!doctype html><html lang=en><title>Document</title><img src=test.png alt=test> | ||
<!doctype html><html lang=en><title>Document</title><img src=test.png alt=test decoding=auto loading=eager referrerpolicy=strict-origin-when-cross-origin> |
8 changes: 4 additions & 4 deletions
8
crates/swc_html_minifier/tests/fixture/attribute/input/output.min.html
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 @@ | ||
<!doctype html><html lang=en><title>Document</title><input name=a> | ||
<input name=b> | ||
<input name=c> | ||
<input name=d> | ||
<!doctype html><html lang=en><title>Document</title><input name=a type=text> | ||
<input name=b type=text> | ||
<input name=c type=text> | ||
<input name=d size=20> |
2 changes: 1 addition & 1 deletion
2
crates/swc_html_minifier/tests/fixture/attribute/javascript-prefix/output.min.html
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
2 changes: 1 addition & 1 deletion
2
crates/swc_html_minifier/tests/fixture/attribute/meter/output.min.html
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 @@ | ||
<!doctype html><html lang=en><title>Document</title><meter id=fuel max=100 low=33 high=66 optimum=80 value=50> | ||
<!doctype html><html lang=en><title>Document</title><meter id=fuel min=0 max=100 low=33 high=66 optimum=80 value=50> | ||
at 50/100 | ||
</meter> |
4 changes: 2 additions & 2 deletions
4
crates/swc_html_minifier/tests/fixture/attribute/ol/output.min.html
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
2 changes: 1 addition & 1 deletion
2
crates/swc_html_minifier/tests/fixture/attribute/progress/output.min.html
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 +1 @@ | ||
<!doctype html><html lang=en><title>Document</title><progress></progress> | ||
<!doctype html><html lang=en><title>Document</title><progress max=1></progress> |
3 changes: 3 additions & 0 deletions
3
crates/swc_html_minifier/tests/fixture/attribute/remove_redundant_attributes-all/config.json
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"removeRedundantAttributes": "all" | ||
} |
Oops, something went wrong.
aa3fab1
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
436307
ns/iter (± 32385
)342019
ns/iter (± 151871
)1.28
es/full/minify/libraries/antd
2126277437
ns/iter (± 66544545
)1807406436
ns/iter (± 34847259
)1.18
es/full/minify/libraries/d3
429381788
ns/iter (± 11305454
)456884850
ns/iter (± 23743350
)0.94
es/full/minify/libraries/echarts
1812696108
ns/iter (± 70089579
)1692449979
ns/iter (± 59458825
)1.07
es/full/minify/libraries/jquery
173313745
ns/iter (± 101346846
)107594006
ns/iter (± 5983772
)1.61
es/full/minify/libraries/lodash
143424466
ns/iter (± 4605003
)149364661
ns/iter (± 58355404
)0.96
es/full/minify/libraries/moment
71211711
ns/iter (± 5020616
)67800793
ns/iter (± 3895890
)1.05
es/full/minify/libraries/react
25783015
ns/iter (± 2638855
)22283238
ns/iter (± 1452895
)1.16
es/full/minify/libraries/terser
346419831
ns/iter (± 23592199
)374569879
ns/iter (± 27228888
)0.92
es/full/minify/libraries/three
625352795
ns/iter (± 40312972
)588540350
ns/iter (± 19794071
)1.06
es/full/minify/libraries/typescript
4148999821
ns/iter (± 117806755
)3669124134
ns/iter (± 142810842
)1.13
es/full/minify/libraries/victory
917375856
ns/iter (± 31948624
)880724365
ns/iter (± 43190149
)1.04
es/full/minify/libraries/vue
187323170
ns/iter (± 22261199
)219084543
ns/iter (± 27156893
)0.86
es/full/codegen/es3
42938
ns/iter (± 1727
)41994
ns/iter (± 9234
)1.02
es/full/codegen/es5
42750
ns/iter (± 5070
)39247
ns/iter (± 7007
)1.09
es/full/codegen/es2015
42222
ns/iter (± 2050
)38428
ns/iter (± 8021
)1.10
es/full/codegen/es2016
42368
ns/iter (± 3179
)36191
ns/iter (± 5883
)1.17
es/full/codegen/es2017
42892
ns/iter (± 2919
)35237
ns/iter (± 6599
)1.22
es/full/codegen/es2018
43464
ns/iter (± 7032
)37290
ns/iter (± 6910
)1.17
es/full/codegen/es2019
42526
ns/iter (± 1851
)39846
ns/iter (± 7687
)1.07
es/full/codegen/es2020
43033
ns/iter (± 2202
)35363
ns/iter (± 6915
)1.22
es/full/all/es3
242975838
ns/iter (± 23480303
)253014717
ns/iter (± 30814215
)0.96
es/full/all/es5
230817583
ns/iter (± 16504197
)241473716
ns/iter (± 21648720
)0.96
es/full/all/es2015
181934898
ns/iter (± 14632648
)195235157
ns/iter (± 22187668
)0.93
es/full/all/es2016
181028295
ns/iter (± 15751721
)192246322
ns/iter (± 26840842
)0.94
es/full/all/es2017
182751339
ns/iter (± 9941067
)167516691
ns/iter (± 16704808
)1.09
es/full/all/es2018
181901217
ns/iter (± 14655668
)165054735
ns/iter (± 21579972
)1.10
es/full/all/es2019
178134235
ns/iter (± 18258760
)160245488
ns/iter (± 9273239
)1.11
es/full/all/es2020
174217115
ns/iter (± 17574202
)184429445
ns/iter (± 25090698
)0.94
es/full/parser
932897
ns/iter (± 133091
)906299
ns/iter (± 383157
)1.03
es/full/base/fixer
32752
ns/iter (± 860
)27252
ns/iter (± 3395
)1.20
es/full/base/resolver_and_hygiene
118428
ns/iter (± 4266
)101271
ns/iter (± 14105
)1.17
serialization of ast node
263
ns/iter (± 24
)261
ns/iter (± 38
)1.01
serialization of serde
272
ns/iter (± 29
)240
ns/iter (± 24
)1.13
This comment was automatically generated by workflow using github-action-benchmark.