-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(common): Add fallible methods to
swc_common::SourceMap
(#9090)
**Description:** This PR will make `swc_ecma_codegen` not `panic` for invalid spans.
- Loading branch information
Showing
2 changed files
with
86 additions
and
29 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
e423d1b
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
277875
ns/iter (± 9273
)291609
ns/iter (± 7556
)0.95
es/full/minify/libraries/antd
1905385495
ns/iter (± 29561995
)1981305935
ns/iter (± 40617167
)0.96
es/full/minify/libraries/d3
363675632
ns/iter (± 14064738
)356011647
ns/iter (± 3113121
)1.02
es/full/minify/libraries/echarts
1652886018
ns/iter (± 24424851
)1677882018
ns/iter (± 31650687
)0.99
es/full/minify/libraries/jquery
103960834
ns/iter (± 752416
)104449686
ns/iter (± 512634
)1.00
es/full/minify/libraries/lodash
115730805
ns/iter (± 914064
)115885436
ns/iter (± 367790
)1.00
es/full/minify/libraries/moment
60285115
ns/iter (± 448460
)60281929
ns/iter (± 173725
)1.00
es/full/minify/libraries/react
18418555
ns/iter (± 381146
)18500931
ns/iter (± 51280
)1.00
es/full/minify/libraries/terser
306876127
ns/iter (± 8225775
)290831341
ns/iter (± 4707340
)1.06
es/full/minify/libraries/three
503885774
ns/iter (± 26870281
)529904721
ns/iter (± 10445698
)0.95
es/full/minify/libraries/typescript
3306812391
ns/iter (± 49136024
)3290623400
ns/iter (± 27802452
)1.00
es/full/minify/libraries/victory
772149986
ns/iter (± 29601757
)755853037
ns/iter (± 18990956
)1.02
es/full/minify/libraries/vue
147225850
ns/iter (± 673947
)146011921
ns/iter (± 972917
)1.01
es/full/codegen/es3
59465
ns/iter (± 197
)60025
ns/iter (± 672
)0.99
es/full/codegen/es5
59467
ns/iter (± 1229
)60247
ns/iter (± 459
)0.99
es/full/codegen/es2015
59616
ns/iter (± 179
)60111
ns/iter (± 227
)0.99
es/full/codegen/es2016
59526
ns/iter (± 87
)59906
ns/iter (± 143
)0.99
es/full/codegen/es2017
59742
ns/iter (± 283
)59909
ns/iter (± 272
)1.00
es/full/codegen/es2018
59462
ns/iter (± 320
)59915
ns/iter (± 164
)0.99
es/full/codegen/es2019
59874
ns/iter (± 141
)59885
ns/iter (± 182
)1.00
es/full/codegen/es2020
59453
ns/iter (± 315
)59925
ns/iter (± 177
)0.99
es/full/all/es3
160869654
ns/iter (± 886228
)161053851
ns/iter (± 890789
)1.00
es/full/all/es5
156096909
ns/iter (± 1077384
)155745522
ns/iter (± 1345519
)1.00
es/full/all/es2015
116448471
ns/iter (± 605946
)115247679
ns/iter (± 563436
)1.01
es/full/all/es2016
114404872
ns/iter (± 813967
)114654564
ns/iter (± 526111
)1.00
es/full/all/es2017
114420390
ns/iter (± 926346
)114065912
ns/iter (± 568193
)1.00
es/full/all/es2018
112755068
ns/iter (± 669409
)111968622
ns/iter (± 1047599
)1.01
es/full/all/es2019
113032425
ns/iter (± 1242205
)110919931
ns/iter (± 845132
)1.02
es/full/all/es2020
107399458
ns/iter (± 726259
)107386517
ns/iter (± 701101
)1.00
es/full/parser
459599
ns/iter (± 3546
)456219
ns/iter (± 2019
)1.01
es/full/base/fixer
15725
ns/iter (± 111
)15539
ns/iter (± 71
)1.01
es/full/base/resolver_and_hygiene
80570
ns/iter (± 271
)81435
ns/iter (± 290
)0.99
serialization of serde
283
ns/iter (± 5
)265
ns/iter (± 7
)1.07
css/minify/libraries/bootstrap
22484991
ns/iter (± 309522
)21925275
ns/iter (± 107971
)1.03
css/visitor/compare/clone
1412849
ns/iter (± 7387
)1399968
ns/iter (± 26727
)1.01
css/visitor/compare/visit_mut_span
1531140
ns/iter (± 5809
)1521433
ns/iter (± 19342
)1.01
css/visitor/compare/visit_mut_span_panic
1539291
ns/iter (± 26240
)1546270
ns/iter (± 5880
)1.00
css/visitor/compare/fold_span
2022530
ns/iter (± 4884
)2039403
ns/iter (± 6578
)0.99
css/visitor/compare/fold_span_panic
2171268
ns/iter (± 2624
)2156781
ns/iter (± 2996
)1.01
css/lexer/bootstrap_5_1_3
3423028
ns/iter (± 2488
)3460072
ns/iter (± 3762
)0.99
css/lexer/foundation_6_7_4
2770936
ns/iter (± 991
)2790045
ns/iter (± 1369
)0.99
css/lexer/tailwind_3_1_1
536438
ns/iter (± 758
)532470
ns/iter (± 382
)1.01
css/parser/bootstrap_5_1_3
15859942
ns/iter (± 104152
)16039266
ns/iter (± 34334
)0.99
css/parser/foundation_6_7_4
12673885
ns/iter (± 28241
)12802782
ns/iter (± 29154
)0.99
css/parser/tailwind_3_1_1
2510539
ns/iter (± 11195
)2581524
ns/iter (± 21061
)0.97
es/codegen/colors
738039
ns/iter (± 414703
)729143
ns/iter (± 399514
)1.01
es/codegen/large
2989471
ns/iter (± 1606540
)3010325
ns/iter (± 1594347
)0.99
es/codegen/with-parser/colors
41229
ns/iter (± 527
)41327
ns/iter (± 411
)1.00
es/codegen/with-parser/large
450211
ns/iter (± 3209
)451933
ns/iter (± 1380
)1.00
es/minify/libraries/antd
1578479496
ns/iter (± 35759551
)1487637633
ns/iter (± 52095785
)1.06
es/minify/libraries/d3
303243734
ns/iter (± 9982504
)291732894
ns/iter (± 12748846
)1.04
es/minify/libraries/echarts
1323109288
ns/iter (± 9974442
)1263005879
ns/iter (± 27130092
)1.05
es/minify/libraries/jquery
82561614
ns/iter (± 392037
)83159447
ns/iter (± 390115
)0.99
es/minify/libraries/lodash
104842487
ns/iter (± 397231
)105183839
ns/iter (± 407475
)1.00
es/minify/libraries/moment
48736379
ns/iter (± 152179
)49244171
ns/iter (± 254735
)0.99
es/minify/libraries/react
16204809
ns/iter (± 24864
)16309590
ns/iter (± 20160
)0.99
es/minify/libraries/terser
218351216
ns/iter (± 1274029
)223425094
ns/iter (± 4251353
)0.98
es/minify/libraries/three
366045635
ns/iter (± 1340979
)381946358
ns/iter (± 24638450
)0.96
es/minify/libraries/typescript
2871554986
ns/iter (± 63910734
)2878746073
ns/iter (± 38418796
)1.00
es/minify/libraries/victory
614322053
ns/iter (± 16539788
)674221067
ns/iter (± 21423722
)0.91
es/minify/libraries/vue
121132037
ns/iter (± 309323
)123759111
ns/iter (± 1193326
)0.98
es/visitor/compare/clone
1719574
ns/iter (± 19012
)1703248
ns/iter (± 9691
)1.01
es/visitor/compare/visit_mut_span
2060672
ns/iter (± 4631
)2041088
ns/iter (± 2389
)1.01
es/visitor/compare/visit_mut_span_panic
2050254
ns/iter (± 32882
)2030526
ns/iter (± 3568
)1.01
es/visitor/compare/fold_span
2759056
ns/iter (± 32835
)2763279
ns/iter (± 12823
)1.00
es/visitor/compare/fold_span_panic
2801615
ns/iter (± 6560
)2797136
ns/iter (± 4715
)1.00
es/lexer/colors
9408
ns/iter (± 39
)9505
ns/iter (± 195
)0.99
es/lexer/angular
4890504
ns/iter (± 24847
)4885195
ns/iter (± 10833
)1.00
es/lexer/backbone
619520
ns/iter (± 3229
)613559
ns/iter (± 1281
)1.01
es/lexer/jquery
3498338
ns/iter (± 21354
)3454508
ns/iter (± 6562
)1.01
es/lexer/jquery mobile
5246989
ns/iter (± 21188
)5151583
ns/iter (± 69334
)1.02
es/lexer/mootools
2714197
ns/iter (± 54643
)2749379
ns/iter (± 4337
)0.99
es/lexer/underscore
507362
ns/iter (± 1926
)515648
ns/iter (± 3626
)0.98
es/lexer/three
15456453
ns/iter (± 31979
)15543270
ns/iter (± 176141
)0.99
es/lexer/yui
2840680
ns/iter (± 24966
)2818113
ns/iter (± 50925
)1.01
es/lexer/cal-com
12556009
ns/iter (± 156977
)12503664
ns/iter (± 100469
)1.00
es/lexer/typescript
87268767
ns/iter (± 771843
)88366758
ns/iter (± 649840
)0.99
es/parser/colors
24221
ns/iter (± 82
)24207
ns/iter (± 452
)1.00
es/parser/angular
12461457
ns/iter (± 85397
)12381757
ns/iter (± 72513
)1.01
es/parser/backbone
1802297
ns/iter (± 8306
)1819446
ns/iter (± 6501
)0.99
es/parser/jquery
9982430
ns/iter (± 145673
)10048030
ns/iter (± 54616
)0.99
es/parser/jquery mobile
14996850
ns/iter (± 126179
)15139985
ns/iter (± 139348
)0.99
es/parser/mootools
7729858
ns/iter (± 19995
)7819964
ns/iter (± 21581
)0.99
es/parser/underscore
1572420
ns/iter (± 15644
)1589380
ns/iter (± 5919
)0.99
es/parser/three
43701522
ns/iter (± 275362
)44053345
ns/iter (± 496953
)0.99
es/parser/yui
7432649
ns/iter (± 60280
)7379593
ns/iter (± 65897
)1.01
es/parser/cal-com
39564391
ns/iter (± 413823
)41075176
ns/iter (± 192337
)0.96
es/parser/typescript
266099062
ns/iter (± 1500173
)269689513
ns/iter (± 3842553
)0.99
es/preset-env/usage/builtin_type
134597
ns/iter (± 33788
)136743
ns/iter (± 36808
)0.98
es/preset-env/usage/property
16174
ns/iter (± 64
)16394
ns/iter (± 71
)0.99
es/resolver/typescript
100523052
ns/iter (± 3334107
)100744702
ns/iter (± 3544517
)1.00
es/fixer/typescript
81040860
ns/iter (± 2741332
)79989774
ns/iter (± 5029994
)1.01
es/hygiene/typescript
188296822
ns/iter (± 2477766
)183694156
ns/iter (± 4149396
)1.03
es/resolver_with_hygiene/typescript
305643800
ns/iter (± 1616980
)302324124
ns/iter (± 2702970
)1.01
es/visitor/base-perf/module_clone
55705
ns/iter (± 747
)56881
ns/iter (± 684
)0.98
es/visitor/base-perf/fold_empty
60816
ns/iter (± 726
)60547
ns/iter (± 532
)1.00
es/visitor/base-perf/fold_noop_impl_all
60682
ns/iter (± 650
)60555
ns/iter (± 763
)1.00
es/visitor/base-perf/fold_noop_impl_vec
60998
ns/iter (± 590
)60426
ns/iter (± 503
)1.01
es/visitor/base-perf/boxing_boxed_clone
60
ns/iter (± 0
)60
ns/iter (± 0
)1
es/visitor/base-perf/boxing_unboxed_clone
47
ns/iter (± 0
)46
ns/iter (± 0
)1.02
es/visitor/base-perf/boxing_boxed
105
ns/iter (± 0
)106
ns/iter (± 0
)0.99
es/visitor/base-perf/boxing_unboxed
81
ns/iter (± 0
)81
ns/iter (± 0
)1
es/visitor/base-perf/visit_contains_this
2623
ns/iter (± 10
)2485
ns/iter (± 12
)1.06
es/base/parallel/resolver/typescript
2426699734
ns/iter (± 106872408
)2510540884
ns/iter (± 143062092
)0.97
es/base/parallel/hygiene/typescript
3239724458
ns/iter (± 39490431
)3115820887
ns/iter (± 54222894
)1.04
babelify-only
498217
ns/iter (± 7667
)477908
ns/iter (± 3854
)1.04
parse_and_babelify_angular
41966963
ns/iter (± 2453199
)40895258
ns/iter (± 820205
)1.03
parse_and_babelify_backbone
4302192
ns/iter (± 164742
)4305135
ns/iter (± 145226
)1.00
parse_and_babelify_jquery
27892274
ns/iter (± 166129
)28151313
ns/iter (± 304406
)0.99
parse_and_babelify_jquery_mobile
47924090
ns/iter (± 481774
)47994025
ns/iter (± 630083
)1.00
parse_and_babelify_mootools
25341225
ns/iter (± 241163
)25432920
ns/iter (± 459544
)1.00
parse_and_babelify_underscore
3635485
ns/iter (± 21399
)3590739
ns/iter (± 25717
)1.01
parse_and_babelify_yui
23458541
ns/iter (± 225241
)23725714
ns/iter (± 447193
)0.99
html/minify/document/css_spec
47611168
ns/iter (± 449088
)45558340
ns/iter (± 452430
)1.05
html/minify/document/github
18694265
ns/iter (± 175958
)18424840
ns/iter (± 194984
)1.01
html/minify/document/stackoverflow
17637925
ns/iter (± 356764
)16875231
ns/iter (± 400132
)1.05
html/minify/document_fragment/css_spec
47350214
ns/iter (± 317371
)44836405
ns/iter (± 91525
)1.06
html/minify/document_fragment/github
18560370
ns/iter (± 86948
)18267316
ns/iter (± 33222
)1.02
html/minify/document_fragment/stackoverflow
17367083
ns/iter (± 259013
)16641264
ns/iter (± 30692
)1.04
html/document/visitor/compare/clone
161392
ns/iter (± 1801
)165820
ns/iter (± 1745
)0.97
html/document/visitor/compare/visit_mut_span
178986
ns/iter (± 1538
)183293
ns/iter (± 1096
)0.98
html/document/visitor/compare/visit_mut_span_panic
182361
ns/iter (± 3943
)191593
ns/iter (± 4882
)0.95
html/document/visitor/compare/fold_span
225568
ns/iter (± 1046
)232630
ns/iter (± 1319
)0.97
html/document/visitor/compare/fold_span_panic
274427
ns/iter (± 1018
)281758
ns/iter (± 1902
)0.97
html/document_fragment/visitor/compare/clone
161790
ns/iter (± 1366
)168122
ns/iter (± 783
)0.96
html/document_fragment/visitor/compare/visit_mut_span
179786
ns/iter (± 1470
)184196
ns/iter (± 1630
)0.98
html/document_fragment/visitor/compare/visit_mut_span_panic
182100
ns/iter (± 1434
)188424
ns/iter (± 1703
)0.97
html/document_fragment/visitor/compare/fold_span
225260
ns/iter (± 909
)230750
ns/iter (± 1442
)0.98
html/document_fragment/visitor/compare/fold_span_panic
277251
ns/iter (± 2335
)284070
ns/iter (± 1656
)0.98
html/lexer/css_2021_spec
12869520
ns/iter (± 118841
)12873925
ns/iter (± 188948
)1.00
html/lexer/github_com_17_05_2022
4920447
ns/iter (± 7210
)4915711
ns/iter (± 15502
)1.00
html/lexer/stackoverflow_com_17_05_2022
4650410
ns/iter (± 43642
)4649654
ns/iter (± 3167
)1.00
html/parser/parser_document/css_2021_spec
25718119
ns/iter (± 95678
)26319142
ns/iter (± 629708
)0.98
html/parser/parser_document/github_com_17_05_2022
8487323
ns/iter (± 25574
)8515829
ns/iter (± 37453
)1.00
html/parser/parser_document/stackoverflow_com_17_05_2022
7492110
ns/iter (± 8781
)7484427
ns/iter (± 18053
)1.00
html/parser/parser_document_fragment/css_2021_spec
25680789
ns/iter (± 71891
)25519590
ns/iter (± 156570
)1.01
html/parser/parser_document_fragment/github_com_17_05_2022
8462779
ns/iter (± 11726
)8473128
ns/iter (± 26690
)1.00
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022
7522587
ns/iter (± 10304
)7393373
ns/iter (± 13551
)1.02
This comment was automatically generated by workflow using github-action-benchmark.