-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(es/typescript): Fix tricky cases in TS fast strip (#9159)
**Description:** We can leverage lexer information to handle tricky cases.
- Loading branch information
Showing
4 changed files
with
59 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
|
||
|
||
export const foo = (id/** Why? */ ) => { | ||
|
||
} |
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,5 @@ | ||
|
||
|
||
export const foo = (id/** Why? */?: string) => { | ||
|
||
} |
2bc51b8
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
278567
ns/iter (± 15849
)294495
ns/iter (± 11552
)0.95
es/full/minify/libraries/antd
1716162461
ns/iter (± 34763166
)1662878455
ns/iter (± 36800019
)1.03
es/full/minify/libraries/d3
337164247
ns/iter (± 1804375
)337088295
ns/iter (± 1516967
)1.00
es/full/minify/libraries/echarts
1422284902
ns/iter (± 23490508
)1393203402
ns/iter (± 15713683
)1.02
es/full/minify/libraries/jquery
101789780
ns/iter (± 113463
)101869618
ns/iter (± 97130
)1.00
es/full/minify/libraries/lodash
113439136
ns/iter (± 202905
)113377611
ns/iter (± 135496
)1.00
es/full/minify/libraries/moment
59163793
ns/iter (± 111494
)59355365
ns/iter (± 102342
)1.00
es/full/minify/libraries/react
18241623
ns/iter (± 70486
)18326092
ns/iter (± 227455
)1.00
es/full/minify/libraries/terser
274080491
ns/iter (± 1854608
)270601280
ns/iter (± 4009545
)1.01
es/full/minify/libraries/three
475560423
ns/iter (± 6515392
)458529448
ns/iter (± 2095342
)1.04
es/full/minify/libraries/typescript
3135575784
ns/iter (± 35664218
)3104615706
ns/iter (± 12933210
)1.01
es/full/minify/libraries/victory
754608324
ns/iter (± 32388380
)698724852
ns/iter (± 7413631
)1.08
es/full/minify/libraries/vue
147967838
ns/iter (± 2237615
)144310316
ns/iter (± 426345
)1.03
es/full/codegen/es3
58700
ns/iter (± 264
)58092
ns/iter (± 384
)1.01
es/full/codegen/es5
58748
ns/iter (± 220
)58364
ns/iter (± 1126
)1.01
es/full/codegen/es2015
58822
ns/iter (± 255
)58239
ns/iter (± 426
)1.01
es/full/codegen/es2016
59049
ns/iter (± 569
)58078
ns/iter (± 126
)1.02
es/full/codegen/es2017
58864
ns/iter (± 184
)58154
ns/iter (± 596
)1.01
es/full/codegen/es2018
58644
ns/iter (± 211
)58308
ns/iter (± 209
)1.01
es/full/codegen/es2019
58568
ns/iter (± 212
)58187
ns/iter (± 105
)1.01
es/full/codegen/es2020
58693
ns/iter (± 198
)58009
ns/iter (± 105
)1.01
es/full/all/es3
159587023
ns/iter (± 940498
)159427068
ns/iter (± 1770422
)1.00
es/full/all/es5
154501309
ns/iter (± 931723
)153254018
ns/iter (± 695146
)1.01
es/full/all/es2015
113608424
ns/iter (± 594059
)113134859
ns/iter (± 605118
)1.00
es/full/all/es2016
112793028
ns/iter (± 704059
)111507127
ns/iter (± 624546
)1.01
es/full/all/es2017
111976410
ns/iter (± 695854
)111019354
ns/iter (± 659185
)1.01
es/full/all/es2018
109981552
ns/iter (± 505635
)108317600
ns/iter (± 797599
)1.02
es/full/all/es2019
109407701
ns/iter (± 557917
)108409787
ns/iter (± 653456
)1.01
es/full/all/es2020
105372673
ns/iter (± 966533
)104647187
ns/iter (± 1492660
)1.01
es/full/parser
450421
ns/iter (± 3825
)445739
ns/iter (± 2628
)1.01
es/full/base/fixer
15597
ns/iter (± 246
)15658
ns/iter (± 71
)1.00
es/full/base/resolver_and_hygiene
80313
ns/iter (± 448
)79648
ns/iter (± 496
)1.01
serialization of serde
273
ns/iter (± 2
)273
ns/iter (± 5
)1
css/minify/libraries/bootstrap
22087608
ns/iter (± 164273
)21950097
ns/iter (± 213546
)1.01
css/visitor/compare/clone
1354637
ns/iter (± 7810
)1351131
ns/iter (± 21947
)1.00
css/visitor/compare/visit_mut_span
1473429
ns/iter (± 6669
)1466411
ns/iter (± 19657
)1.00
css/visitor/compare/visit_mut_span_panic
1496859
ns/iter (± 18606
)1489119
ns/iter (± 5376
)1.01
css/visitor/compare/fold_span
1994577
ns/iter (± 4648
)1982311
ns/iter (± 9098
)1.01
css/visitor/compare/fold_span_panic
2116240
ns/iter (± 2264
)2110733
ns/iter (± 109495
)1.00
css/lexer/bootstrap_5_1_3
3468384
ns/iter (± 17063
)3484501
ns/iter (± 89692
)1.00
css/lexer/foundation_6_7_4
2787669
ns/iter (± 5700
)2833045
ns/iter (± 4203
)0.98
css/lexer/tailwind_3_1_1
534938
ns/iter (± 1200
)540130
ns/iter (± 7147
)0.99
css/parser/bootstrap_5_1_3
16014638
ns/iter (± 109166
)15976282
ns/iter (± 15923
)1.00
css/parser/foundation_6_7_4
12783516
ns/iter (± 63800
)12799908
ns/iter (± 44397
)1.00
css/parser/tailwind_3_1_1
2553651
ns/iter (± 2890
)2533491
ns/iter (± 5234
)1.01
es/codegen/colors
727048
ns/iter (± 397634
)745105
ns/iter (± 394877
)0.98
es/codegen/large
3008937
ns/iter (± 1620687
)2998782
ns/iter (± 1587304
)1.00
es/codegen/with-parser/colors
40212
ns/iter (± 492
)40579
ns/iter (± 490
)0.99
es/codegen/with-parser/large
450175
ns/iter (± 2619
)448138
ns/iter (± 1604
)1.00
es/minify/libraries/antd
1483913453
ns/iter (± 33509590
)1383397556
ns/iter (± 42533010
)1.07
es/minify/libraries/d3
299081368
ns/iter (± 8529025
)285885412
ns/iter (± 14699820
)1.05
es/minify/libraries/echarts
1267226165
ns/iter (± 18246171
)1228791189
ns/iter (± 26798720
)1.03
es/minify/libraries/jquery
83604457
ns/iter (± 302410
)83632201
ns/iter (± 1268234
)1.00
es/minify/libraries/lodash
105928705
ns/iter (± 251096
)103712518
ns/iter (± 169193
)1.02
es/minify/libraries/moment
48942711
ns/iter (± 256334
)48075862
ns/iter (± 50756
)1.02
es/minify/libraries/react
16356352
ns/iter (± 119384
)16176464
ns/iter (± 180525
)1.01
es/minify/libraries/terser
232773142
ns/iter (± 3190688
)219830837
ns/iter (± 2834736
)1.06
es/minify/libraries/three
400665771
ns/iter (± 3293734
)367616508
ns/iter (± 14826608
)1.09
es/minify/libraries/typescript
2861358339
ns/iter (± 15638111
)2750677681
ns/iter (± 66618780
)1.04
es/minify/libraries/victory
670213274
ns/iter (± 9979539
)646623466
ns/iter (± 24675822
)1.04
es/minify/libraries/vue
122620817
ns/iter (± 595818
)121857128
ns/iter (± 2073023
)1.01
es/visitor/compare/clone
1737934
ns/iter (± 6836
)1712589
ns/iter (± 17175
)1.01
es/visitor/compare/visit_mut_span
2075961
ns/iter (± 20193
)2047074
ns/iter (± 4609
)1.01
es/visitor/compare/visit_mut_span_panic
2094237
ns/iter (± 157990
)2054749
ns/iter (± 25286
)1.02
es/visitor/compare/fold_span
2800978
ns/iter (± 9049
)2839358
ns/iter (± 50045
)0.99
es/visitor/compare/fold_span_panic
2822500
ns/iter (± 12050
)2817723
ns/iter (± 13503
)1.00
es/lexer/colors
9369
ns/iter (± 41
)9427
ns/iter (± 32
)0.99
es/lexer/angular
4915174
ns/iter (± 60056
)4891131
ns/iter (± 37809
)1.00
es/lexer/backbone
634227
ns/iter (± 1721
)646686
ns/iter (± 6980
)0.98
es/lexer/jquery
3608208
ns/iter (± 8559
)3624524
ns/iter (± 14178
)1.00
es/lexer/jquery mobile
5434120
ns/iter (± 40623
)5306024
ns/iter (± 4959
)1.02
es/lexer/mootools
2802447
ns/iter (± 4023
)2838183
ns/iter (± 51976
)0.99
es/lexer/underscore
526217
ns/iter (± 1740
)527215
ns/iter (± 1584
)1.00
es/lexer/three
16451850
ns/iter (± 65595
)16194065
ns/iter (± 33280
)1.02
es/lexer/yui
2853185
ns/iter (± 8785
)2861373
ns/iter (± 5653
)1.00
es/lexer/cal-com
13114719
ns/iter (± 65396
)13099085
ns/iter (± 86613
)1.00
es/lexer/typescript
91984495
ns/iter (± 1026780
)92540474
ns/iter (± 344725
)0.99
es/parser/colors
23566
ns/iter (± 46
)23666
ns/iter (± 82
)1.00
es/parser/angular
12481024
ns/iter (± 172574
)12614981
ns/iter (± 110621
)0.99
es/parser/backbone
1812826
ns/iter (± 10631
)1810480
ns/iter (± 5660
)1.00
es/parser/jquery
10025730
ns/iter (± 53170
)10023745
ns/iter (± 52487
)1.00
es/parser/jquery mobile
15167663
ns/iter (± 125117
)15221359
ns/iter (± 101422
)1.00
es/parser/mootools
7796456
ns/iter (± 18183
)7811613
ns/iter (± 17871
)1.00
es/parser/underscore
1577895
ns/iter (± 7670
)1581842
ns/iter (± 6427
)1.00
es/parser/three
45034297
ns/iter (± 511052
)43636289
ns/iter (± 294581
)1.03
es/parser/yui
7388686
ns/iter (± 36665
)7380331
ns/iter (± 42543
)1.00
es/parser/cal-com
41290771
ns/iter (± 730674
)39665572
ns/iter (± 135186
)1.04
es/parser/typescript
271485575
ns/iter (± 715577
)269318412
ns/iter (± 1089573
)1.01
es/preset-env/usage/builtin_type
136500
ns/iter (± 32942
)135895
ns/iter (± 35496
)1.00
es/preset-env/usage/property
16971
ns/iter (± 89
)15706
ns/iter (± 65
)1.08
es/resolver/typescript
105836979
ns/iter (± 2472678
)96005919
ns/iter (± 1486439
)1.10
es/fixer/typescript
84751838
ns/iter (± 1585515
)78799157
ns/iter (± 3356533
)1.08
es/hygiene/typescript
198991173
ns/iter (± 3316535
)173065576
ns/iter (± 4607808
)1.15
es/resolver_with_hygiene/typescript
336856849
ns/iter (± 4595803
)305679960
ns/iter (± 6442230
)1.10
es/visitor/base-perf/module_clone
56558
ns/iter (± 819
)60983
ns/iter (± 800
)0.93
es/visitor/base-perf/fold_empty
60145
ns/iter (± 1073
)63648
ns/iter (± 335
)0.94
es/visitor/base-perf/fold_noop_impl_all
60037
ns/iter (± 780
)64018
ns/iter (± 747
)0.94
es/visitor/base-perf/fold_noop_impl_vec
59992
ns/iter (± 566
)64008
ns/iter (± 716
)0.94
es/visitor/base-perf/boxing_boxed_clone
59
ns/iter (± 0
)65
ns/iter (± 0
)0.91
es/visitor/base-perf/boxing_unboxed_clone
48
ns/iter (± 0
)48
ns/iter (± 0
)1
es/visitor/base-perf/boxing_boxed
105
ns/iter (± 0
)109
ns/iter (± 0
)0.96
es/visitor/base-perf/boxing_unboxed
82
ns/iter (± 0
)80
ns/iter (± 0
)1.02
es/visitor/base-perf/visit_contains_this
2477
ns/iter (± 24
)2482
ns/iter (± 18
)1.00
es/base/parallel/resolver/typescript
2449878711
ns/iter (± 71683387
)2460211246
ns/iter (± 87116129
)1.00
es/base/parallel/hygiene/typescript
3405571175
ns/iter (± 31325394
)3223947459
ns/iter (± 138735478
)1.06
babelify-only
497202
ns/iter (± 3656
)495345
ns/iter (± 12183
)1.00
parse_and_babelify_angular
38804932
ns/iter (± 410152
)43909074
ns/iter (± 2808897
)0.88
parse_and_babelify_backbone
4370293
ns/iter (± 160937
)4532791
ns/iter (± 229504
)0.96
parse_and_babelify_jquery
28791829
ns/iter (± 202313
)30631777
ns/iter (± 472079
)0.94
parse_and_babelify_jquery_mobile
50316326
ns/iter (± 560648
)52675415
ns/iter (± 903143
)0.96
parse_and_babelify_mootools
26282676
ns/iter (± 167268
)28229362
ns/iter (± 317624
)0.93
parse_and_babelify_underscore
3660367
ns/iter (± 18871
)3693286
ns/iter (± 24178
)0.99
parse_and_babelify_yui
24516625
ns/iter (± 150167
)27135393
ns/iter (± 537020
)0.90
html/minify/document/css_spec
45855735
ns/iter (± 179793
)46119834
ns/iter (± 490820
)0.99
html/minify/document/github
18414991
ns/iter (± 98639
)18486497
ns/iter (± 207080
)1.00
html/minify/document/stackoverflow
16732207
ns/iter (± 464917
)16919143
ns/iter (± 489684
)0.99
html/minify/document_fragment/css_spec
45099755
ns/iter (± 797072
)45125376
ns/iter (± 332139
)1.00
html/minify/document_fragment/github
18196855
ns/iter (± 42111
)18013233
ns/iter (± 119663
)1.01
html/minify/document_fragment/stackoverflow
16512007
ns/iter (± 124991
)16398342
ns/iter (± 121659
)1.01
html/document/visitor/compare/clone
162617
ns/iter (± 949
)163246
ns/iter (± 1228
)1.00
html/document/visitor/compare/visit_mut_span
180157
ns/iter (± 871
)178216
ns/iter (± 873
)1.01
html/document/visitor/compare/visit_mut_span_panic
184588
ns/iter (± 5788
)185630
ns/iter (± 4296
)0.99
html/document/visitor/compare/fold_span
228893
ns/iter (± 667
)228407
ns/iter (± 1053
)1.00
html/document/visitor/compare/fold_span_panic
278970
ns/iter (± 555
)277435
ns/iter (± 447
)1.01
html/document_fragment/visitor/compare/clone
165129
ns/iter (± 750
)163149
ns/iter (± 613
)1.01
html/document_fragment/visitor/compare/visit_mut_span
180122
ns/iter (± 472
)179685
ns/iter (± 575
)1.00
html/document_fragment/visitor/compare/visit_mut_span_panic
185815
ns/iter (± 743
)184746
ns/iter (± 1187
)1.01
html/document_fragment/visitor/compare/fold_span
228805
ns/iter (± 853
)226786
ns/iter (± 1122
)1.01
html/document_fragment/visitor/compare/fold_span_panic
277942
ns/iter (± 950
)276423
ns/iter (± 1278
)1.01
html/lexer/css_2021_spec
12946874
ns/iter (± 54082
)12898743
ns/iter (± 229800
)1.00
html/lexer/github_com_17_05_2022
4972383
ns/iter (± 16503
)4984624
ns/iter (± 7508
)1.00
html/lexer/stackoverflow_com_17_05_2022
4714116
ns/iter (± 12195
)4690995
ns/iter (± 9190
)1.00
html/parser/parser_document/css_2021_spec
25269436
ns/iter (± 66076
)26105066
ns/iter (± 25780
)0.97
html/parser/parser_document/github_com_17_05_2022
8479059
ns/iter (± 29766
)8792377
ns/iter (± 22872
)0.96
html/parser/parser_document/stackoverflow_com_17_05_2022
7385194
ns/iter (± 10135
)7573981
ns/iter (± 13437
)0.98
html/parser/parser_document_fragment/css_2021_spec
24831175
ns/iter (± 43128
)26001741
ns/iter (± 576799
)0.95
html/parser/parser_document_fragment/github_com_17_05_2022
8422932
ns/iter (± 23328
)8761342
ns/iter (± 21133
)0.96
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022
7340436
ns/iter (± 10980
)7559919
ns/iter (± 25926
)0.97
This comment was automatically generated by workflow using github-action-benchmark.