-
-
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.
perf(es/lexer): Optimize lexer (#9075)
**Description:** - `TokenContext` is now 1 byte. - `read_word_with` now uses `&dyn` instead of `impl FnOnce`.
- Loading branch information
Showing
3 changed files
with
46 additions
and
53 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
6426928
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
297024
ns/iter (± 6679
)280327
ns/iter (± 6743
)1.06
es/full/minify/libraries/antd
2042491599
ns/iter (± 38561340
)1913069636
ns/iter (± 111261804
)1.07
es/full/minify/libraries/d3
399571106
ns/iter (± 5078299
)382309343
ns/iter (± 7376354
)1.05
es/full/minify/libraries/echarts
1734434572
ns/iter (± 15325791
)1710333748
ns/iter (± 47175057
)1.01
es/full/minify/libraries/jquery
106245144
ns/iter (± 1223850
)103831084
ns/iter (± 632271
)1.02
es/full/minify/libraries/lodash
117047242
ns/iter (± 883997
)114214100
ns/iter (± 294164
)1.02
es/full/minify/libraries/moment
60489422
ns/iter (± 285608
)59487896
ns/iter (± 167936
)1.02
es/full/minify/libraries/react
18538061
ns/iter (± 62908
)18347771
ns/iter (± 145435
)1.01
es/full/minify/libraries/terser
304982350
ns/iter (± 2473360
)282643405
ns/iter (± 4023890
)1.08
es/full/minify/libraries/three
552215413
ns/iter (± 7244349
)492508876
ns/iter (± 12648773
)1.12
es/full/minify/libraries/typescript
3436816600
ns/iter (± 37297033
)3235229727
ns/iter (± 28628404
)1.06
es/full/minify/libraries/victory
947376612
ns/iter (± 18884928
)750487362
ns/iter (± 19950654
)1.26
es/full/minify/libraries/vue
150922506
ns/iter (± 1553895
)145551120
ns/iter (± 669794
)1.04
es/full/codegen/es3
59721
ns/iter (± 127
)59684
ns/iter (± 121
)1.00
es/full/codegen/es5
60408
ns/iter (± 415
)60020
ns/iter (± 1141
)1.01
es/full/codegen/es2015
59830
ns/iter (± 364
)59740
ns/iter (± 149
)1.00
es/full/codegen/es2016
59690
ns/iter (± 154
)59713
ns/iter (± 146
)1.00
es/full/codegen/es2017
59707
ns/iter (± 120
)59761
ns/iter (± 161
)1.00
es/full/codegen/es2018
59615
ns/iter (± 80
)59967
ns/iter (± 163
)0.99
es/full/codegen/es2019
59724
ns/iter (± 90
)59864
ns/iter (± 158
)1.00
es/full/codegen/es2020
59536
ns/iter (± 183
)59608
ns/iter (± 324
)1.00
es/full/all/es3
165812330
ns/iter (± 1797687
)163128881
ns/iter (± 673681
)1.02
es/full/all/es5
160719582
ns/iter (± 820091
)157520087
ns/iter (± 685096
)1.02
es/full/all/es2015
118681865
ns/iter (± 880279
)117717981
ns/iter (± 778180
)1.01
es/full/all/es2016
116768359
ns/iter (± 586376
)117102688
ns/iter (± 895729
)1.00
es/full/all/es2017
116329269
ns/iter (± 737134
)115932104
ns/iter (± 800515
)1.00
es/full/all/es2018
114434726
ns/iter (± 730841
)114383728
ns/iter (± 529053
)1.00
es/full/all/es2019
114966667
ns/iter (± 758900
)113693558
ns/iter (± 816011
)1.01
es/full/all/es2020
109703594
ns/iter (± 841774
)109847499
ns/iter (± 1145666
)1.00
es/full/parser
484361
ns/iter (± 5510
)473220
ns/iter (± 3193
)1.02
es/full/base/fixer
15163
ns/iter (± 69
)15715
ns/iter (± 107
)0.96
es/full/base/resolver_and_hygiene
78937
ns/iter (± 241
)79887
ns/iter (± 3518
)0.99
serialization of serde
278
ns/iter (± 9
)273
ns/iter (± 6
)1.02
css/minify/libraries/bootstrap
21893721
ns/iter (± 250957
)22394438
ns/iter (± 263111
)0.98
css/visitor/compare/clone
1397438
ns/iter (± 10792
)1403696
ns/iter (± 16393
)1.00
css/visitor/compare/visit_mut_span
1518919
ns/iter (± 7985
)1527230
ns/iter (± 7286
)0.99
css/visitor/compare/visit_mut_span_panic
1536625
ns/iter (± 19884
)1548684
ns/iter (± 43048
)0.99
css/visitor/compare/fold_span
2062027
ns/iter (± 5090
)2039803
ns/iter (± 5604
)1.01
css/visitor/compare/fold_span_panic
2172400
ns/iter (± 4738
)2166088
ns/iter (± 4733
)1.00
css/lexer/bootstrap_5_1_3
3401658
ns/iter (± 14751
)3405780
ns/iter (± 23643
)1.00
css/lexer/foundation_6_7_4
2757338
ns/iter (± 5598
)2761690
ns/iter (± 94751
)1.00
css/lexer/tailwind_3_1_1
526137
ns/iter (± 322
)527039
ns/iter (± 1425
)1.00
css/parser/bootstrap_5_1_3
16163314
ns/iter (± 45578
)16143874
ns/iter (± 56127
)1.00
css/parser/foundation_6_7_4
12885701
ns/iter (± 222570
)12880326
ns/iter (± 22940
)1.00
css/parser/tailwind_3_1_1
2557413
ns/iter (± 5409
)2553203
ns/iter (± 9681
)1.00
es/codegen/colors
708556
ns/iter (± 390355
)728851
ns/iter (± 398849
)0.97
es/codegen/large
2994189
ns/iter (± 1603183
)3000904
ns/iter (± 1610632
)1.00
es/codegen/with-parser/colors
41699
ns/iter (± 455
)42049
ns/iter (± 225
)0.99
es/codegen/with-parser/large
454473
ns/iter (± 1961
)456997
ns/iter (± 31202
)0.99
es/minify/libraries/antd
1660150750
ns/iter (± 41553547
)1482849158
ns/iter (± 37596756
)1.12
es/minify/libraries/d3
358788890
ns/iter (± 9621500
)285587130
ns/iter (± 6096822
)1.26
es/minify/libraries/echarts
1385004459
ns/iter (± 14609561
)1206144445
ns/iter (± 10592611
)1.15
es/minify/libraries/jquery
93671740
ns/iter (± 1711064
)82924744
ns/iter (± 1022974
)1.13
es/minify/libraries/lodash
110726655
ns/iter (± 1081675
)104757044
ns/iter (± 207729
)1.06
es/minify/libraries/moment
50175406
ns/iter (± 186715
)48558338
ns/iter (± 60084
)1.03
es/minify/libraries/react
16978034
ns/iter (± 50489
)16343641
ns/iter (± 21213
)1.04
es/minify/libraries/terser
270567467
ns/iter (± 4070915
)218846619
ns/iter (± 984570
)1.24
es/minify/libraries/three
474270540
ns/iter (± 4942209
)370663656
ns/iter (± 6106758
)1.28
es/minify/libraries/typescript
2927273049
ns/iter (± 26912059
)2762696828
ns/iter (± 20799943
)1.06
es/minify/libraries/victory
710420356
ns/iter (± 16964886
)594380927
ns/iter (± 12080303
)1.20
es/minify/libraries/vue
122790668
ns/iter (± 711362
)122099617
ns/iter (± 1860800
)1.01
es/visitor/compare/clone
1683744
ns/iter (± 6686
)1726948
ns/iter (± 4750
)0.97
es/visitor/compare/visit_mut_span
2020696
ns/iter (± 9239
)2060605
ns/iter (± 11005
)0.98
es/visitor/compare/visit_mut_span_panic
2016470
ns/iter (± 20993
)2107972
ns/iter (± 44318
)0.96
es/visitor/compare/fold_span
2727865
ns/iter (± 5929
)2778845
ns/iter (± 7387
)0.98
es/visitor/compare/fold_span_panic
2763366
ns/iter (± 3169
)2828553
ns/iter (± 7571
)0.98
es/lexer/colors
9777
ns/iter (± 26
)10362
ns/iter (± 24
)0.94
es/lexer/angular
5117679
ns/iter (± 23055
)5096441
ns/iter (± 29097
)1.00
es/lexer/backbone
660840
ns/iter (± 2682
)643235
ns/iter (± 1821
)1.03
es/lexer/jquery
3566791
ns/iter (± 3809
)3692540
ns/iter (± 14943
)0.97
es/lexer/jquery mobile
5345639
ns/iter (± 14445
)5508323
ns/iter (± 123332
)0.97
es/lexer/mootools
2875128
ns/iter (± 21553
)2874552
ns/iter (± 20753
)1.00
es/lexer/underscore
532769
ns/iter (± 602
)539412
ns/iter (± 1922
)0.99
es/lexer/three
16331780
ns/iter (± 94428
)16845690
ns/iter (± 108829
)0.97
es/lexer/yui
2970361
ns/iter (± 3873
)2978630
ns/iter (± 2904
)1.00
es/lexer/cal-com
12982352
ns/iter (± 43846
)13522890
ns/iter (± 58561
)0.96
es/lexer/typescript
90949731
ns/iter (± 447483
)93934551
ns/iter (± 1453385
)0.97
es/parser/colors
24580
ns/iter (± 124
)25069
ns/iter (± 130
)0.98
es/parser/angular
12424789
ns/iter (± 147560
)12815692
ns/iter (± 72207
)0.97
es/parser/backbone
1835741
ns/iter (± 8000
)1849524
ns/iter (± 7848
)0.99
es/parser/jquery
10093791
ns/iter (± 160507
)10239803
ns/iter (± 56621
)0.99
es/parser/jquery mobile
15268349
ns/iter (± 97897
)15455592
ns/iter (± 90990
)0.99
es/parser/mootools
7846791
ns/iter (± 14183
)7996888
ns/iter (± 18483
)0.98
es/parser/underscore
1594569
ns/iter (± 8927
)1616499
ns/iter (± 5807
)0.99
es/parser/three
43655555
ns/iter (± 294234
)44188427
ns/iter (± 285394
)0.99
es/parser/yui
7496580
ns/iter (± 45866
)7590759
ns/iter (± 32845
)0.99
es/parser/cal-com
39928200
ns/iter (± 260500
)41316821
ns/iter (± 708377
)0.97
es/parser/typescript
269758547
ns/iter (± 1236592
)275217122
ns/iter (± 2292263
)0.98
es/preset-env/usage/builtin_type
136454
ns/iter (± 34767
)141799
ns/iter (± 33723
)0.96
es/preset-env/usage/property
16620
ns/iter (± 121
)16600
ns/iter (± 113
)1.00
es/resolver/typescript
100034028
ns/iter (± 2698678
)105244532
ns/iter (± 2343329
)0.95
es/fixer/typescript
79478664
ns/iter (± 4749582
)84344429
ns/iter (± 5776074
)0.94
es/hygiene/typescript
184559918
ns/iter (± 5411647
)209491936
ns/iter (± 3259504
)0.88
es/resolver_with_hygiene/typescript
310996032
ns/iter (± 3411752
)326725229
ns/iter (± 3807303
)0.95
es/visitor/base-perf/module_clone
56763
ns/iter (± 912
)57312
ns/iter (± 392
)0.99
es/visitor/base-perf/fold_empty
60222
ns/iter (± 794
)60385
ns/iter (± 779
)1.00
es/visitor/base-perf/fold_noop_impl_all
60745
ns/iter (± 838
)60760
ns/iter (± 438
)1.00
es/visitor/base-perf/fold_noop_impl_vec
60627
ns/iter (± 680
)60863
ns/iter (± 255
)1.00
es/visitor/base-perf/boxing_boxed_clone
58
ns/iter (± 0
)60
ns/iter (± 0
)0.97
es/visitor/base-perf/boxing_unboxed_clone
47
ns/iter (± 0
)47
ns/iter (± 0
)1
es/visitor/base-perf/boxing_boxed
106
ns/iter (± 0
)106
ns/iter (± 0
)1
es/visitor/base-perf/boxing_unboxed
82
ns/iter (± 0
)81
ns/iter (± 0
)1.01
es/visitor/base-perf/visit_contains_this
2462
ns/iter (± 19
)2474
ns/iter (± 13
)1.00
es/base/parallel/resolver/typescript
2422314327
ns/iter (± 106731532
)2620770108
ns/iter (± 187517135
)0.92
es/base/parallel/hygiene/typescript
3215614515
ns/iter (± 32862941
)3459165530
ns/iter (± 118274545
)0.93
babelify-only
480027
ns/iter (± 5987
)476446
ns/iter (± 10065
)1.01
parse_and_babelify_angular
38738072
ns/iter (± 999683
)42010511
ns/iter (± 1055307
)0.92
parse_and_babelify_backbone
4750652
ns/iter (± 190392
)4546038
ns/iter (± 294981
)1.05
parse_and_babelify_jquery
30361717
ns/iter (± 876596
)29823102
ns/iter (± 316528
)1.02
parse_and_babelify_jquery_mobile
49935560
ns/iter (± 879279
)52854990
ns/iter (± 953630
)0.94
parse_and_babelify_mootools
26698334
ns/iter (± 482395
)27487143
ns/iter (± 336121
)0.97
parse_and_babelify_underscore
3698352
ns/iter (± 39655
)3684703
ns/iter (± 17886
)1.00
parse_and_babelify_yui
24989030
ns/iter (± 909478
)25003515
ns/iter (± 1002709
)1.00
html/minify/document/css_spec
45612799
ns/iter (± 474317
)45469565
ns/iter (± 289961
)1.00
html/minify/document/github
17858159
ns/iter (± 85105
)18155982
ns/iter (± 252861
)0.98
html/minify/document/stackoverflow
16248417
ns/iter (± 487811
)16613836
ns/iter (± 335456
)0.98
html/minify/document_fragment/css_spec
44263581
ns/iter (± 416858
)46327256
ns/iter (± 346005
)0.96
html/minify/document_fragment/github
17603939
ns/iter (± 18626
)18118441
ns/iter (± 34473
)0.97
html/minify/document_fragment/stackoverflow
16152566
ns/iter (± 86207
)16716482
ns/iter (± 35003
)0.97
html/document/visitor/compare/clone
165725
ns/iter (± 1972
)168664
ns/iter (± 1308
)0.98
html/document/visitor/compare/visit_mut_span
182728
ns/iter (± 1500
)186384
ns/iter (± 3589
)0.98
html/document/visitor/compare/visit_mut_span_panic
187768
ns/iter (± 3108
)189846
ns/iter (± 7670
)0.99
html/document/visitor/compare/fold_span
228793
ns/iter (± 2647
)232158
ns/iter (± 1711
)0.99
html/document/visitor/compare/fold_span_panic
276339
ns/iter (± 1660
)281996
ns/iter (± 1659
)0.98
html/document_fragment/visitor/compare/clone
165107
ns/iter (± 905
)169323
ns/iter (± 1769
)0.98
html/document_fragment/visitor/compare/visit_mut_span
183506
ns/iter (± 1365
)184534
ns/iter (± 1681
)0.99
html/document_fragment/visitor/compare/visit_mut_span_panic
185667
ns/iter (± 1371
)190812
ns/iter (± 3450
)0.97
html/document_fragment/visitor/compare/fold_span
229095
ns/iter (± 819
)230672
ns/iter (± 2627
)0.99
html/document_fragment/visitor/compare/fold_span_panic
277934
ns/iter (± 9473
)281430
ns/iter (± 1155
)0.99
html/lexer/css_2021_spec
12949772
ns/iter (± 135368
)12867872
ns/iter (± 33698
)1.01
html/lexer/github_com_17_05_2022
4932298
ns/iter (± 70224
)4902965
ns/iter (± 78007
)1.01
html/lexer/stackoverflow_com_17_05_2022
4683889
ns/iter (± 3603
)4653564
ns/iter (± 3975
)1.01
html/parser/parser_document/css_2021_spec
26197956
ns/iter (± 351280
)25183148
ns/iter (± 363461
)1.04
html/parser/parser_document/github_com_17_05_2022
8628078
ns/iter (± 60969
)8422110
ns/iter (± 14678
)1.02
html/parser/parser_document/stackoverflow_com_17_05_2022
7463495
ns/iter (± 10622
)7292514
ns/iter (± 15684
)1.02
html/parser/parser_document_fragment/css_2021_spec
25300387
ns/iter (± 283278
)24748151
ns/iter (± 98012
)1.02
html/parser/parser_document_fragment/github_com_17_05_2022
8517107
ns/iter (± 71188
)8387524
ns/iter (± 31974
)1.02
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022
7396567
ns/iter (± 38730
)7294714
ns/iter (± 40624
)1.01
This comment was automatically generated by workflow using github-action-benchmark.