Skip to content

Commit

Permalink
perf(es/parser): Increase token context size (#9104)
Browse files Browse the repository at this point in the history
**Description:**

Now, `TokenContext` is 1 byte, so we can increase the stack size for it.

```
Gnuplot not found, using plotters backend
Benchmarking es/parser/colors
Benchmarking es/parser/colors: Warming up for 3.0000 s
Benchmarking es/parser/colors: Collecting 100 samples in estimated 5.0243 s (561k iterations)
Benchmarking es/parser/colors: Analyzing
es/parser/colors        time:   [8.8652 µs 8.8821 µs 8.9013 µs]
                        change: [+0.3001% +0.6986% +1.0681%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 9 outliers among 100 measurements (9.00%)
  4 (4.00%) high mild
  5 (5.00%) high severe

Benchmarking es/parser/angular
Benchmarking es/parser/angular: Warming up for 3.0000 s
Benchmarking es/parser/angular: Collecting 100 samples in estimated 5.1460 s (1100 iterations)
Benchmarking es/parser/angular: Analyzing
es/parser/angular       time:   [4.5989 ms 4.6075 ms 4.6180 ms]
                        change: [+1.5999% +1.9780% +2.3764%] (p = 0.00 < 0.05)
                        Performance has regressed.
Found 8 outliers among 100 measurements (8.00%)
  1 (1.00%) high mild
  7 (7.00%) high severe

Benchmarking es/parser/backbone
Benchmarking es/parser/backbone: Warming up for 3.0000 s
Benchmarking es/parser/backbone: Collecting 100 samples in estimated 7.0775 s (10k iterations)
Benchmarking es/parser/backbone: Analyzing
es/parser/backbone      time:   [694.50 µs 695.84 µs 697.51 µs]
                        change: [-1.1099% -0.7438% -0.3658%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 13 outliers among 100 measurements (13.00%)
  5 (5.00%) high mild
  8 (8.00%) high severe

Benchmarking es/parser/jquery
Benchmarking es/parser/jquery: Warming up for 3.0000 s
Benchmarking es/parser/jquery: Collecting 100 samples in estimated 5.1340 s (1300 iterations)
Benchmarking es/parser/jquery: Analyzing
es/parser/jquery        time:   [3.9253 ms 3.9334 ms 3.9430 ms]
                        change: [+0.2515% +0.6374% +1.0228%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 10 outliers among 100 measurements (10.00%)
  3 (3.00%) high mild
  7 (7.00%) high severe

Benchmarking es/parser/jquery mobile
Benchmarking es/parser/jquery mobile: Warming up for 3.0000 s
Benchmarking es/parser/jquery mobile: Collecting 100 samples in estimated 5.3971 s (900 iterations)
Benchmarking es/parser/jquery mobile: Analyzing
es/parser/jquery mobile time:   [5.9041 ms 5.9175 ms 5.9340 ms]
                        change: [-1.8844% -1.5663% -1.2247%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 11 outliers among 100 measurements (11.00%)
  4 (4.00%) high mild
  7 (7.00%) high severe

Benchmarking es/parser/mootools
Benchmarking es/parser/mootools: Warming up for 3.0000 s
Benchmarking es/parser/mootools: Collecting 100 samples in estimated 5.1747 s (1700 iterations)
Benchmarking es/parser/mootools: Analyzing
es/parser/mootools      time:   [3.0240 ms 3.0352 ms 3.0489 ms]
                        change: [-1.5654% -1.1553% -0.6819%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 7 outliers among 100 measurements (7.00%)
  1 (1.00%) high mild
  6 (6.00%) high severe

Benchmarking es/parser/underscore
Benchmarking es/parser/underscore: Warming up for 3.0000 s
Benchmarking es/parser/underscore: Collecting 100 samples in estimated 6.1976 s (10k iterations)
Benchmarking es/parser/underscore: Analyzing
es/parser/underscore    time:   [612.60 µs 614.58 µs 616.82 µs]
                        change: [-1.9306% -1.5582% -1.1803%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 7 outliers among 100 measurements (7.00%)
  4 (4.00%) high mild
  3 (3.00%) high severe

Benchmarking es/parser/three
Benchmarking es/parser/three: Warming up for 3.0000 s
Benchmarking es/parser/three: Collecting 100 samples in estimated 5.1445 s (300 iterations)
Benchmarking es/parser/three: Analyzing
es/parser/three         time:   [16.890 ms 16.951 ms 17.026 ms]
                        change: [-2.1520% -1.7192% -1.2254%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 17 outliers among 100 measurements (17.00%)
  3 (3.00%) high mild
  14 (14.00%) high severe

Benchmarking es/parser/yui
Benchmarking es/parser/yui: Warming up for 3.0000 s
Benchmarking es/parser/yui: Collecting 100 samples in estimated 5.0417 s (1800 iterations)
Benchmarking es/parser/yui: Analyzing
es/parser/yui           time:   [2.8076 ms 2.8156 ms 2.8249 ms]
                        change: [-2.2730% -1.9284% -1.5384%] (p = 0.00 < 0.05)
                        Performance has improved.
Found 16 outliers among 100 measurements (16.00%)
  5 (5.00%) high mild
  11 (11.00%) high severe

Benchmarking es/parser/cal-com
Benchmarking es/parser/cal-com: Warming up for 3.0000 s
Benchmarking es/parser/cal-com: Collecting 100 samples in estimated 5.9664 s (400 iterations)
Benchmarking es/parser/cal-com: Analyzing
es/parser/cal-com       time:   [14.815 ms 14.888 ms 14.974 ms]
                        change: [-1.2376% -0.7153% -0.1968%] (p = 0.01 < 0.05)
                        Change within noise threshold.
Found 17 outliers among 100 measurements (17.00%)
  1 (1.00%) high mild
  16 (16.00%) high severe

Benchmarking es/parser/typescript
Benchmarking es/parser/typescript: Warming up for 3.0000 s


Warning: Unable to complete 100 samples in 5.0s. You may wish to increase target time to 10.5s, or reduce sample count to 40.
Benchmarking es/parser/typescript: Collecting 100 samples in estimated 10.496 s (100 iterations)
Benchmarking es/parser/typescript: Analyzing
es/parser/typescript    time:   [101.97 ms 102.32 ms 102.73 ms]
                        change: [-1.6102% -1.1640% -0.7126%] (p = 0.00 < 0.05)
                        Change within noise threshold.
Found 14 outliers among 100 measurements (14.00%)
  4 (4.00%) high mild
  10 (10.00%) high severe

```
  • Loading branch information
kdy1 authored Jun 25, 2024
1 parent feae5a9 commit 8ef30cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion crates/swc_ecma_parser/src/lexer/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ impl State {
}

#[derive(Clone, Default)]
pub struct TokenContexts(pub(crate) SmallVec<[TokenContext; 32]>);
pub struct TokenContexts(pub(crate) SmallVec<[TokenContext; 128]>);

impl TokenContexts {
/// Returns true if following `LBrace` token is `block statement` according
Expand Down

1 comment on commit 8ef30cc

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark

Benchmark suite Current: 8ef30cc Previous: c0602c8 Ratio
es/full/bugs-1 277173 ns/iter (± 3123) 274082 ns/iter (± 2620) 1.01
es/full/minify/libraries/antd 2021256199 ns/iter (± 35238005) 1859303119 ns/iter (± 67284245) 1.09
es/full/minify/libraries/d3 400983199 ns/iter (± 12235885) 358671942 ns/iter (± 4784875) 1.12
es/full/minify/libraries/echarts 1698521459 ns/iter (± 14264891) 1668433104 ns/iter (± 31982412) 1.02
es/full/minify/libraries/jquery 107116522 ns/iter (± 1154548) 105896653 ns/iter (± 687705) 1.01
es/full/minify/libraries/lodash 117693311 ns/iter (± 799943) 115979077 ns/iter (± 1353914) 1.01
es/full/minify/libraries/moment 61114027 ns/iter (± 533841) 60268708 ns/iter (± 307677) 1.01
es/full/minify/libraries/react 18640865 ns/iter (± 78001) 18319651 ns/iter (± 91693) 1.02
es/full/minify/libraries/terser 295637335 ns/iter (± 6653613) 275087977 ns/iter (± 5860760) 1.07
es/full/minify/libraries/three 516700125 ns/iter (± 17966877) 478679319 ns/iter (± 5745718) 1.08
es/full/minify/libraries/typescript 3467015277 ns/iter (± 31725111) 3199796015 ns/iter (± 30705977) 1.08
es/full/minify/libraries/victory 927838972 ns/iter (± 39615392) 856289342 ns/iter (± 55752964) 1.08
es/full/minify/libraries/vue 152618463 ns/iter (± 2073321) 145754512 ns/iter (± 777692) 1.05
es/full/codegen/es3 58486 ns/iter (± 801) 57969 ns/iter (± 538) 1.01
es/full/codegen/es5 58576 ns/iter (± 294) 57952 ns/iter (± 182) 1.01
es/full/codegen/es2015 58364 ns/iter (± 253) 57772 ns/iter (± 262) 1.01
es/full/codegen/es2016 58402 ns/iter (± 145) 57783 ns/iter (± 163) 1.01
es/full/codegen/es2017 58662 ns/iter (± 208) 57878 ns/iter (± 229) 1.01
es/full/codegen/es2018 58644 ns/iter (± 197) 57853 ns/iter (± 223) 1.01
es/full/codegen/es2019 58597 ns/iter (± 3260) 57949 ns/iter (± 281) 1.01
es/full/codegen/es2020 58561 ns/iter (± 141) 58230 ns/iter (± 213) 1.01
es/full/all/es3 157133177 ns/iter (± 1789592) 158665887 ns/iter (± 908043) 0.99
es/full/all/es5 151619886 ns/iter (± 604305) 153667597 ns/iter (± 900782) 0.99
es/full/all/es2015 112133018 ns/iter (± 1098222) 112595137 ns/iter (± 908638) 1.00
es/full/all/es2016 110438045 ns/iter (± 917714) 111992458 ns/iter (± 790961) 0.99
es/full/all/es2017 110908602 ns/iter (± 1355052) 111234745 ns/iter (± 558585) 1.00
es/full/all/es2018 108810907 ns/iter (± 494710) 108857249 ns/iter (± 597028) 1.00
es/full/all/es2019 108168131 ns/iter (± 712287) 107674030 ns/iter (± 692980) 1.00
es/full/all/es2020 104256302 ns/iter (± 888590) 104316334 ns/iter (± 506174) 1.00
es/full/parser 431710 ns/iter (± 4078) 424310 ns/iter (± 2281) 1.02
es/full/base/fixer 15446 ns/iter (± 71) 15407 ns/iter (± 85) 1.00
es/full/base/resolver_and_hygiene 80600 ns/iter (± 1476) 80040 ns/iter (± 166) 1.01
serialization of serde 277 ns/iter (± 0) 271 ns/iter (± 8) 1.02
css/minify/libraries/bootstrap 22238628 ns/iter (± 105460) 21874967 ns/iter (± 36017) 1.02
css/visitor/compare/clone 1400672 ns/iter (± 32630) 1376986 ns/iter (± 10984) 1.02
css/visitor/compare/visit_mut_span 1515462 ns/iter (± 8962) 1506696 ns/iter (± 11732) 1.01
css/visitor/compare/visit_mut_span_panic 1547505 ns/iter (± 23122) 1514681 ns/iter (± 46121) 1.02
css/visitor/compare/fold_span 2037770 ns/iter (± 24482) 2007886 ns/iter (± 8771) 1.01
css/visitor/compare/fold_span_panic 2177527 ns/iter (± 10344) 2145991 ns/iter (± 7071) 1.01
css/lexer/bootstrap_5_1_3 3461278 ns/iter (± 3977) 3461906 ns/iter (± 15483) 1.00
css/lexer/foundation_6_7_4 2798925 ns/iter (± 3780) 2807718 ns/iter (± 2962) 1.00
css/lexer/tailwind_3_1_1 537324 ns/iter (± 397) 539238 ns/iter (± 4440) 1.00
css/parser/bootstrap_5_1_3 16465476 ns/iter (± 108424) 16612549 ns/iter (± 45314) 0.99
css/parser/foundation_6_7_4 13224686 ns/iter (± 184168) 13226729 ns/iter (± 149615) 1.00
css/parser/tailwind_3_1_1 2559935 ns/iter (± 76565) 2602224 ns/iter (± 8545) 0.98
es/codegen/colors 713533 ns/iter (± 392528) 729675 ns/iter (± 401082) 0.98
es/codegen/large 2993809 ns/iter (± 1594560) 2862851 ns/iter (± 1541915) 1.05
es/codegen/with-parser/colors 40100 ns/iter (± 357) 42447 ns/iter (± 804) 0.94
es/codegen/with-parser/large 454318 ns/iter (± 2074) 476802 ns/iter (± 47404) 0.95
es/minify/libraries/antd 1606835714 ns/iter (± 29863722) 1537764475 ns/iter (± 24465264) 1.04
es/minify/libraries/d3 342369096 ns/iter (± 10411455) 303369685 ns/iter (± 12173969) 1.13
es/minify/libraries/echarts 1351446103 ns/iter (± 21104288) 1259308623 ns/iter (± 14551672) 1.07
es/minify/libraries/jquery 85503316 ns/iter (± 887153) 82712964 ns/iter (± 316487) 1.03
es/minify/libraries/lodash 106710375 ns/iter (± 764583) 105300016 ns/iter (± 825865) 1.01
es/minify/libraries/moment 49813025 ns/iter (± 308882) 48578169 ns/iter (± 333970) 1.03
es/minify/libraries/react 16466208 ns/iter (± 98178) 16327551 ns/iter (± 45349) 1.01
es/minify/libraries/terser 225249824 ns/iter (± 3637426) 233933941 ns/iter (± 4101839) 0.96
es/minify/libraries/three 389704275 ns/iter (± 12480790) 410163163 ns/iter (± 22287731) 0.95
es/minify/libraries/typescript 2788212828 ns/iter (± 19339216) 2795001845 ns/iter (± 38682821) 1.00
es/minify/libraries/victory 621960278 ns/iter (± 9885942) 613598069 ns/iter (± 7556082) 1.01
es/minify/libraries/vue 122037783 ns/iter (± 587103) 124509692 ns/iter (± 1449331) 0.98
es/visitor/compare/clone 1734482 ns/iter (± 5819) 1743697 ns/iter (± 8600) 0.99
es/visitor/compare/visit_mut_span 2079191 ns/iter (± 4051) 2089390 ns/iter (± 8023) 1.00
es/visitor/compare/visit_mut_span_panic 2080330 ns/iter (± 18392) 2091567 ns/iter (± 30623) 0.99
es/visitor/compare/fold_span 2789725 ns/iter (± 28484) 2807371 ns/iter (± 13953) 0.99
es/visitor/compare/fold_span_panic 2840355 ns/iter (± 4291) 2864858 ns/iter (± 18068) 0.99
es/lexer/colors 8340 ns/iter (± 30) 8692 ns/iter (± 38) 0.96
es/lexer/angular 4179101 ns/iter (± 17673) 4186817 ns/iter (± 17841) 1.00
es/lexer/backbone 632825 ns/iter (± 1716) 642627 ns/iter (± 5522) 0.98
es/lexer/jquery 3553245 ns/iter (± 47074) 3535465 ns/iter (± 6197) 1.01
es/lexer/jquery mobile 5372204 ns/iter (± 16210) 5276727 ns/iter (± 38127) 1.02
es/lexer/mootools 2867453 ns/iter (± 25638) 2824583 ns/iter (± 5035) 1.02
es/lexer/underscore 536916 ns/iter (± 1228) 525150 ns/iter (± 1160) 1.02
es/lexer/three 15816124 ns/iter (± 28621) 15983580 ns/iter (± 27003) 0.99
es/lexer/yui 2748313 ns/iter (± 26890) 2758730 ns/iter (± 4118) 1.00
es/lexer/cal-com 13031928 ns/iter (± 75376) 12885133 ns/iter (± 23029) 1.01
es/lexer/typescript 93208211 ns/iter (± 528816) 93457164 ns/iter (± 469433) 1.00
es/parser/colors 22616 ns/iter (± 138) 22445 ns/iter (± 154) 1.01
es/parser/angular 11809496 ns/iter (± 73510) 11833877 ns/iter (± 160114) 1.00
es/parser/backbone 1838841 ns/iter (± 5698) 1810362 ns/iter (± 7599) 1.02
es/parser/jquery 10106111 ns/iter (± 74314) 10065783 ns/iter (± 81467) 1.00
es/parser/jquery mobile 15249862 ns/iter (± 102120) 15687128 ns/iter (± 392488) 0.97
es/parser/mootools 7896697 ns/iter (± 11465) 7792080 ns/iter (± 98607) 1.01
es/parser/underscore 1601474 ns/iter (± 5946) 1584690 ns/iter (± 7051) 1.01
es/parser/three 43817144 ns/iter (± 234933) 45450181 ns/iter (± 554532) 0.96
es/parser/yui 7289518 ns/iter (± 62907) 7313280 ns/iter (± 73279) 1.00
es/parser/cal-com 39512786 ns/iter (± 191423) 41315682 ns/iter (± 661368) 0.96
es/parser/typescript 273422593 ns/iter (± 1877005) 275279658 ns/iter (± 1690750) 0.99
es/preset-env/usage/builtin_type 137753 ns/iter (± 34887) 135884 ns/iter (± 33385) 1.01
es/preset-env/usage/property 16855 ns/iter (± 90) 17381 ns/iter (± 97) 0.97
es/resolver/typescript 98826119 ns/iter (± 2082414) 103737124 ns/iter (± 2050784) 0.95
es/fixer/typescript 81532087 ns/iter (± 3414532) 79822490 ns/iter (± 2974280) 1.02
es/hygiene/typescript 178319055 ns/iter (± 4199745) 178967473 ns/iter (± 5137377) 1.00
es/resolver_with_hygiene/typescript 301361275 ns/iter (± 4418534) 304325025 ns/iter (± 6409342) 0.99
es/visitor/base-perf/module_clone 56303 ns/iter (± 449) 56777 ns/iter (± 680) 0.99
es/visitor/base-perf/fold_empty 59423 ns/iter (± 655) 60068 ns/iter (± 382) 0.99
es/visitor/base-perf/fold_noop_impl_all 59477 ns/iter (± 730) 60453 ns/iter (± 547) 0.98
es/visitor/base-perf/fold_noop_impl_vec 59658 ns/iter (± 538) 59938 ns/iter (± 1080) 1.00
es/visitor/base-perf/boxing_boxed_clone 59 ns/iter (± 0) 60 ns/iter (± 0) 0.98
es/visitor/base-perf/boxing_unboxed_clone 47 ns/iter (± 0) 47 ns/iter (± 0) 1
es/visitor/base-perf/boxing_boxed 105 ns/iter (± 0) 105 ns/iter (± 0) 1
es/visitor/base-perf/boxing_unboxed 82 ns/iter (± 0) 80 ns/iter (± 0) 1.02
es/visitor/base-perf/visit_contains_this 2669 ns/iter (± 31) 2581 ns/iter (± 12) 1.03
es/base/parallel/resolver/typescript 2429459406 ns/iter (± 133204166) 2443015871 ns/iter (± 145346324) 0.99
es/base/parallel/hygiene/typescript 3236122155 ns/iter (± 42381377) 3207735004 ns/iter (± 49389563) 1.01
babelify-only 493119 ns/iter (± 6583) 498769 ns/iter (± 9262) 0.99
parse_and_babelify_angular 41729039 ns/iter (± 4185410) 45972099 ns/iter (± 851028) 0.91
parse_and_babelify_backbone 4426418 ns/iter (± 162895) 4482983 ns/iter (± 226934) 0.99
parse_and_babelify_jquery 29464522 ns/iter (± 308205) 31869437 ns/iter (± 1303178) 0.92
parse_and_babelify_jquery_mobile 52188167 ns/iter (± 638211) 54424159 ns/iter (± 3278430) 0.96
parse_and_babelify_mootools 26657431 ns/iter (± 332858) 28187123 ns/iter (± 1093401) 0.95
parse_and_babelify_underscore 3702607 ns/iter (± 20242) 3679736 ns/iter (± 28566) 1.01
parse_and_babelify_yui 26741635 ns/iter (± 1563673) 28499648 ns/iter (± 3064695) 0.94
html/minify/document/css_spec 45388248 ns/iter (± 159652) 46709914 ns/iter (± 1740048) 0.97
html/minify/document/github 18189977 ns/iter (± 83273) 18315264 ns/iter (± 75821) 0.99
html/minify/document/stackoverflow 16567800 ns/iter (± 671215) 16928361 ns/iter (± 476425) 0.98
html/minify/document_fragment/css_spec 44265506 ns/iter (± 64738) 44874572 ns/iter (± 285283) 0.99
html/minify/document_fragment/github 17862388 ns/iter (± 70645) 17977561 ns/iter (± 66595) 0.99
html/minify/document_fragment/stackoverflow 16183072 ns/iter (± 19273) 16818836 ns/iter (± 297249) 0.96
html/document/visitor/compare/clone 164146 ns/iter (± 1989) 165248 ns/iter (± 2338) 0.99
html/document/visitor/compare/visit_mut_span 179951 ns/iter (± 1095) 182919 ns/iter (± 1578) 0.98
html/document/visitor/compare/visit_mut_span_panic 185856 ns/iter (± 3583) 188297 ns/iter (± 9164) 0.99
html/document/visitor/compare/fold_span 230277 ns/iter (± 1876) 227802 ns/iter (± 1153) 1.01
html/document/visitor/compare/fold_span_panic 279438 ns/iter (± 745) 281111 ns/iter (± 2026) 0.99
html/document_fragment/visitor/compare/clone 164661 ns/iter (± 824) 164413 ns/iter (± 1755) 1.00
html/document_fragment/visitor/compare/visit_mut_span 181005 ns/iter (± 2268) 181344 ns/iter (± 1335) 1.00
html/document_fragment/visitor/compare/visit_mut_span_panic 186043 ns/iter (± 1019) 186895 ns/iter (± 1451) 1.00
html/document_fragment/visitor/compare/fold_span 231619 ns/iter (± 1143) 229908 ns/iter (± 725) 1.01
html/document_fragment/visitor/compare/fold_span_panic 278859 ns/iter (± 1645) 279226 ns/iter (± 1816) 1.00
html/lexer/css_2021_spec 12902935 ns/iter (± 20881) 12985388 ns/iter (± 22242) 0.99
html/lexer/github_com_17_05_2022 4967659 ns/iter (± 106560) 4962804 ns/iter (± 45347) 1.00
html/lexer/stackoverflow_com_17_05_2022 4707214 ns/iter (± 5792) 4732570 ns/iter (± 9786) 0.99
html/parser/parser_document/css_2021_spec 26761724 ns/iter (± 104740) 25627141 ns/iter (± 172440) 1.04
html/parser/parser_document/github_com_17_05_2022 8664231 ns/iter (± 18426) 8583699 ns/iter (± 33009) 1.01
html/parser/parser_document/stackoverflow_com_17_05_2022 7569119 ns/iter (± 14644) 7524445 ns/iter (± 15706) 1.01
html/parser/parser_document_fragment/css_2021_spec 26654758 ns/iter (± 231912) 25501158 ns/iter (± 113460) 1.05
html/parser/parser_document_fragment/github_com_17_05_2022 8714091 ns/iter (± 16960) 8552630 ns/iter (± 15343) 1.02
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022 7621768 ns/iter (± 20508) 7539844 ns/iter (± 140662) 1.01

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.