Skip to content

Commit

Permalink
fix(es/testing): Fix PluginCommentProxy (#9170)
Browse files Browse the repository at this point in the history
**Related issue:**

 - Closes #9169
  • Loading branch information
kdy1 authored Jul 6, 2024
1 parent 3b7b2a1 commit d86ca2d
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions crates/swc_plugin_proxy/src/comments/plugin_comments_proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,68 +77,68 @@ impl PluginCommentsProxy {
#[swc_trace]
impl Comments for PluginCommentsProxy {
fn add_leading(&self, pos: BytePos, cmt: Comment) {
swc_common::comments::COMMENTS.with(|comments| {
comments.add_leading(pos, cmt);
swc_common::comments::COMMENTS.with(|c| {
c.add_leading(pos, cmt);
});
}

fn add_leading_comments(&self, pos: BytePos, comments: Vec<Comment>) {
swc_common::comments::COMMENTS.with(|comments| {
comments.add_leading_comments(pos, comments);
swc_common::comments::COMMENTS.with(|c| {
c.add_leading_comments(pos, comments);
});
}

fn has_leading(&self, pos: BytePos) -> bool {
swc_common::comments::COMMENTS.with(|comments| comments.has_leading(pos))
swc_common::comments::COMMENTS.with(|c| c.has_leading(pos))
}

fn move_leading(&self, from: BytePos, to: BytePos) {
swc_common::comments::COMMENTS.with(|comments| {
comments.move_leading(from, to);
swc_common::comments::COMMENTS.with(|c| {
c.move_leading(from, to);
});
}

fn take_leading(&self, pos: BytePos) -> Option<Vec<Comment>> {
swc_common::comments::COMMENTS.with(|comments| comments.take_leading(pos))
swc_common::comments::COMMENTS.with(|c| c.take_leading(pos))
}

fn get_leading(&self, pos: BytePos) -> Option<Vec<Comment>> {
swc_common::comments::COMMENTS.with(|comments| comments.get_leading(pos))
swc_common::comments::COMMENTS.with(|c| c.get_leading(pos))
}

fn add_trailing(&self, pos: BytePos, cmt: Comment) {
swc_common::comments::COMMENTS.with(|comments| {
comments.add_trailing(pos, cmt);
swc_common::comments::COMMENTS.with(|c| {
c.add_trailing(pos, cmt);
});
}

fn add_trailing_comments(&self, pos: BytePos, comments: Vec<Comment>) {
swc_common::comments::COMMENTS.with(|comments| {
comments.add_trailing_comments(pos, comments);
swc_common::comments::COMMENTS.with(|c| {
c.add_trailing_comments(pos, comments);
});
}

fn has_trailing(&self, pos: BytePos) -> bool {
swc_common::comments::COMMENTS.with(|comments| comments.has_trailing(pos))
swc_common::comments::COMMENTS.with(|c| c.has_trailing(pos))
}

fn move_trailing(&self, from: BytePos, to: BytePos) {
swc_common::comments::COMMENTS.with(|comments| {
comments.move_trailing(from, to);
swc_common::comments::COMMENTS.with(|c| {
c.move_trailing(from, to);
});
}

fn take_trailing(&self, pos: BytePos) -> Option<Vec<Comment>> {
swc_common::comments::COMMENTS.with(|comments| comments.take_trailing(pos))
swc_common::comments::COMMENTS.with(|c| c.take_trailing(pos))
}

fn get_trailing(&self, pos: BytePos) -> Option<Vec<Comment>> {
swc_common::comments::COMMENTS.with(|comments| comments.get_trailing(pos))
swc_common::comments::COMMENTS.with(|c| c.get_trailing(pos))
}

fn add_pure_comment(&self, pos: BytePos) {
swc_common::comments::COMMENTS.with(|comments| {
comments.add_pure_comment(pos);
swc_common::comments::COMMENTS.with(|c| {
c.add_pure_comment(pos);
});
}
}
Expand Down

1 comment on commit d86ca2d

@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: d86ca2d Previous: ee8dc28 Ratio
es/full/bugs-1 295119 ns/iter (± 11477) 268569 ns/iter (± 2299) 1.10
es/full/minify/libraries/antd 1775644746 ns/iter (± 56643561) 1632015782 ns/iter (± 33257094) 1.09
es/full/minify/libraries/d3 340892999 ns/iter (± 3358812) 330406775 ns/iter (± 1409994) 1.03
es/full/minify/libraries/echarts 1497860758 ns/iter (± 16099921) 1345683405 ns/iter (± 4330959) 1.11
es/full/minify/libraries/jquery 101297817 ns/iter (± 292059) 100420569 ns/iter (± 85372) 1.01
es/full/minify/libraries/lodash 112665344 ns/iter (± 310835) 111574557 ns/iter (± 402229) 1.01
es/full/minify/libraries/moment 58604422 ns/iter (± 293827) 58531351 ns/iter (± 76147) 1.00
es/full/minify/libraries/react 18069175 ns/iter (± 28090) 18189043 ns/iter (± 21253) 0.99
es/full/minify/libraries/terser 270704853 ns/iter (± 2517045) 265107173 ns/iter (± 632846) 1.02
es/full/minify/libraries/three 479368458 ns/iter (± 10925179) 446851981 ns/iter (± 5610033) 1.07
es/full/minify/libraries/typescript 3193928946 ns/iter (± 18782531) 3068402896 ns/iter (± 9022888) 1.04
es/full/minify/libraries/victory 721997223 ns/iter (± 25152034) 678223463 ns/iter (± 2736929) 1.06
es/full/minify/libraries/vue 143713069 ns/iter (± 335718) 141957573 ns/iter (± 244667) 1.01
es/full/codegen/es3 58274 ns/iter (± 213) 57798 ns/iter (± 222) 1.01
es/full/codegen/es5 58488 ns/iter (± 335) 57996 ns/iter (± 154) 1.01
es/full/codegen/es2015 58508 ns/iter (± 167) 58062 ns/iter (± 424) 1.01
es/full/codegen/es2016 58514 ns/iter (± 137) 58101 ns/iter (± 222) 1.01
es/full/codegen/es2017 58455 ns/iter (± 223) 57871 ns/iter (± 398) 1.01
es/full/codegen/es2018 58524 ns/iter (± 170) 58140 ns/iter (± 307) 1.01
es/full/codegen/es2019 58467 ns/iter (± 125) 58076 ns/iter (± 203) 1.01
es/full/codegen/es2020 58460 ns/iter (± 164) 58004 ns/iter (± 238) 1.01
es/full/all/es3 159672332 ns/iter (± 1206038) 159260784 ns/iter (± 738835) 1.00
es/full/all/es5 153597885 ns/iter (± 671571) 153848449 ns/iter (± 852922) 1.00
es/full/all/es2015 113840227 ns/iter (± 412558) 113620902 ns/iter (± 1479095) 1.00
es/full/all/es2016 113168126 ns/iter (± 562689) 112699534 ns/iter (± 752569) 1.00
es/full/all/es2017 111909656 ns/iter (± 1027459) 112220925 ns/iter (± 591326) 1.00
es/full/all/es2018 110184800 ns/iter (± 459501) 110467025 ns/iter (± 714687) 1.00
es/full/all/es2019 110179366 ns/iter (± 362566) 109456381 ns/iter (± 779062) 1.01
es/full/all/es2020 106006586 ns/iter (± 782515) 105971462 ns/iter (± 1051535) 1.00
es/full/parser 452424 ns/iter (± 3363) 444285 ns/iter (± 3131) 1.02
es/full/base/fixer 15232 ns/iter (± 122) 15362 ns/iter (± 48) 0.99
es/full/base/resolver_and_hygiene 79082 ns/iter (± 241) 79755 ns/iter (± 332) 0.99
serialization of serde 270 ns/iter (± 1) 276 ns/iter (± 6) 0.98
css/minify/libraries/bootstrap 21815533 ns/iter (± 147316) 21723403 ns/iter (± 289660) 1.00
css/visitor/compare/clone 1397067 ns/iter (± 12755) 1386553 ns/iter (± 17023) 1.01
css/visitor/compare/visit_mut_span 1539515 ns/iter (± 7165) 1514262 ns/iter (± 9339) 1.02
css/visitor/compare/visit_mut_span_panic 1542651 ns/iter (± 33158) 1536080 ns/iter (± 14163) 1.00
css/visitor/compare/fold_span 2030906 ns/iter (± 5087) 2026837 ns/iter (± 7373) 1.00
css/visitor/compare/fold_span_panic 2179477 ns/iter (± 6682) 2145259 ns/iter (± 4624) 1.02
css/lexer/bootstrap_5_1_3 3501394 ns/iter (± 2457) 3516269 ns/iter (± 7058) 1.00
css/lexer/foundation_6_7_4 2825671 ns/iter (± 3411) 2843644 ns/iter (± 12887) 0.99
css/lexer/tailwind_3_1_1 539464 ns/iter (± 954) 542873 ns/iter (± 340) 0.99
css/parser/bootstrap_5_1_3 15895196 ns/iter (± 44917) 15879248 ns/iter (± 25623) 1.00
css/parser/foundation_6_7_4 12738760 ns/iter (± 9899) 12724487 ns/iter (± 32191) 1.00
css/parser/tailwind_3_1_1 2520779 ns/iter (± 1875) 2524447 ns/iter (± 2403) 1.00
es/codegen/colors 722232 ns/iter (± 395386) 718478 ns/iter (± 393623) 1.01
es/codegen/large 3019635 ns/iter (± 1603167) 2999299 ns/iter (± 1574057) 1.01
es/codegen/with-parser/colors 40268 ns/iter (± 265) 40791 ns/iter (± 331) 0.99
es/codegen/with-parser/large 451222 ns/iter (± 1227) 454450 ns/iter (± 1078) 0.99
es/minify/libraries/antd 1322749062 ns/iter (± 31800470) 1404739275 ns/iter (± 24772336) 0.94
es/minify/libraries/d3 279523364 ns/iter (± 3453744) 284262836 ns/iter (± 11436433) 0.98
es/minify/libraries/echarts 1115954809 ns/iter (± 9940987) 1145978385 ns/iter (± 10990993) 0.97
es/minify/libraries/jquery 82439143 ns/iter (± 694118) 82307529 ns/iter (± 474164) 1.00
es/minify/libraries/lodash 104084283 ns/iter (± 521134) 104357092 ns/iter (± 159649) 1.00
es/minify/libraries/moment 48131870 ns/iter (± 53996) 47956894 ns/iter (± 145448) 1.00
es/minify/libraries/react 16300315 ns/iter (± 20925) 16204119 ns/iter (± 16078) 1.01
es/minify/libraries/terser 217632281 ns/iter (± 1732247) 216718530 ns/iter (± 708048) 1.00
es/minify/libraries/three 364442731 ns/iter (± 8934658) 365041056 ns/iter (± 5393887) 1.00
es/minify/libraries/typescript 2709439852 ns/iter (± 38323716) 2716806859 ns/iter (± 13287436) 1.00
es/minify/libraries/victory 583294375 ns/iter (± 6496535) 569995722 ns/iter (± 8936781) 1.02
es/minify/libraries/vue 121403417 ns/iter (± 258866) 120365063 ns/iter (± 1186490) 1.01
es/visitor/compare/clone 1715677 ns/iter (± 16566) 1705508 ns/iter (± 5736) 1.01
es/visitor/compare/visit_mut_span 2059705 ns/iter (± 7783) 2043306 ns/iter (± 4914) 1.01
es/visitor/compare/visit_mut_span_panic 2064244 ns/iter (± 44802) 2048671 ns/iter (± 45902) 1.01
es/visitor/compare/fold_span 2785959 ns/iter (± 5344) 2749859 ns/iter (± 8076) 1.01
es/visitor/compare/fold_span_panic 2820661 ns/iter (± 27612) 2790336 ns/iter (± 8719) 1.01
es/lexer/colors 9523 ns/iter (± 48) 9476 ns/iter (± 98) 1.00
es/lexer/angular 4888647 ns/iter (± 20136) 4974965 ns/iter (± 17095) 0.98
es/lexer/backbone 630329 ns/iter (± 3952) 632467 ns/iter (± 1500) 1.00
es/lexer/jquery 3623818 ns/iter (± 24861) 3716443 ns/iter (± 19925) 0.98
es/lexer/jquery mobile 5411885 ns/iter (± 97626) 5517431 ns/iter (± 17886) 0.98
es/lexer/mootools 2926726 ns/iter (± 10424) 2930004 ns/iter (± 12969) 1.00
es/lexer/underscore 544893 ns/iter (± 2179) 543811 ns/iter (± 2046) 1.00
es/lexer/three 16090295 ns/iter (± 55692) 16166161 ns/iter (± 28819) 1.00
es/lexer/yui 2910548 ns/iter (± 7917) 2992269 ns/iter (± 4975) 0.97
es/lexer/cal-com 13091606 ns/iter (± 42868) 13104116 ns/iter (± 471377) 1.00
es/lexer/typescript 92046289 ns/iter (± 199711) 90894015 ns/iter (± 339396) 1.01
es/parser/colors 24946 ns/iter (± 287) 24018 ns/iter (± 133) 1.04
es/parser/angular 13026302 ns/iter (± 87007) 12675733 ns/iter (± 81512) 1.03
es/parser/backbone 1875331 ns/iter (± 5826) 1836472 ns/iter (± 9835) 1.02
es/parser/jquery 10313793 ns/iter (± 67065) 10075912 ns/iter (± 55284) 1.02
es/parser/jquery mobile 15576035 ns/iter (± 119235) 15204611 ns/iter (± 94766) 1.02
es/parser/mootools 8072900 ns/iter (± 20738) 7882630 ns/iter (± 18323) 1.02
es/parser/underscore 1637369 ns/iter (± 7805) 1598032 ns/iter (± 9336) 1.02
es/parser/three 45315272 ns/iter (± 1337242) 43222822 ns/iter (± 215263) 1.05
es/parser/yui 7667967 ns/iter (± 51838) 7481716 ns/iter (± 33839) 1.02
es/parser/cal-com 39961073 ns/iter (± 173886) 39460645 ns/iter (± 326680) 1.01
es/parser/typescript 278733123 ns/iter (± 1843730) 267607016 ns/iter (± 1040671) 1.04
es/preset-env/usage/builtin_type 136426 ns/iter (± 34340) 137011 ns/iter (± 33720) 1.00
es/preset-env/usage/property 16880 ns/iter (± 127) 16624 ns/iter (± 158) 1.02
es/resolver/typescript 96506420 ns/iter (± 2366147) 96872048 ns/iter (± 2492384) 1.00
es/fixer/typescript 80986274 ns/iter (± 2830278) 81651198 ns/iter (± 2884347) 0.99
es/hygiene/typescript 183918627 ns/iter (± 4873219) 184553086 ns/iter (± 3720131) 1.00
es/resolver_with_hygiene/typescript 309651541 ns/iter (± 7286160) 312241186 ns/iter (± 4240935) 0.99
es/visitor/base-perf/module_clone 55972 ns/iter (± 2971) 56731 ns/iter (± 501) 0.99
es/visitor/base-perf/fold_empty 59628 ns/iter (± 844) 59929 ns/iter (± 2145) 0.99
es/visitor/base-perf/fold_noop_impl_all 59258 ns/iter (± 1115) 60269 ns/iter (± 1065) 0.98
es/visitor/base-perf/fold_noop_impl_vec 60276 ns/iter (± 1379) 59647 ns/iter (± 840) 1.01
es/visitor/base-perf/boxing_boxed_clone 59 ns/iter (± 0) 59 ns/iter (± 0) 1
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) 105 ns/iter (± 1) 1.01
es/visitor/base-perf/boxing_unboxed 80 ns/iter (± 0) 80 ns/iter (± 1) 1
es/visitor/base-perf/visit_contains_this 2474 ns/iter (± 15) 2486 ns/iter (± 43) 1.00
es/base/parallel/resolver/typescript 2390466154 ns/iter (± 95425775) 2468111836 ns/iter (± 157716426) 0.97
es/base/parallel/hygiene/typescript 3241152681 ns/iter (± 55892693) 3216836585 ns/iter (± 56809267) 1.01
babelify-only 493711 ns/iter (± 4680) 490363 ns/iter (± 12437) 1.01
parse_and_babelify_angular 42519576 ns/iter (± 2347778) 44275698 ns/iter (± 1629228) 0.96
parse_and_babelify_backbone 4388380 ns/iter (± 150629) 4339842 ns/iter (± 128966) 1.01
parse_and_babelify_jquery 28218797 ns/iter (± 164229) 28102766 ns/iter (± 202987) 1.00
parse_and_babelify_jquery_mobile 50014115 ns/iter (± 826839) 48432000 ns/iter (± 646772) 1.03
parse_and_babelify_mootools 25647318 ns/iter (± 255211) 25424391 ns/iter (± 239087) 1.01
parse_and_babelify_underscore 3663490 ns/iter (± 14018) 3672927 ns/iter (± 14076) 1.00
parse_and_babelify_yui 27292044 ns/iter (± 1687458) 24984220 ns/iter (± 1285566) 1.09
html/minify/document/css_spec 45973075 ns/iter (± 88168) 45812902 ns/iter (± 256245) 1.00
html/minify/document/github 18623930 ns/iter (± 33565) 18578586 ns/iter (± 58914) 1.00
html/minify/document/stackoverflow 16822472 ns/iter (± 659411) 17111172 ns/iter (± 362163) 0.98
html/minify/document_fragment/css_spec 44609656 ns/iter (± 51728) 44580464 ns/iter (± 75728) 1.00
html/minify/document_fragment/github 18174324 ns/iter (± 38679) 18242913 ns/iter (± 34238) 1.00
html/minify/document_fragment/stackoverflow 16466897 ns/iter (± 31356) 16546645 ns/iter (± 9581) 1.00
html/document/visitor/compare/clone 171375 ns/iter (± 1919) 165943 ns/iter (± 806) 1.03
html/document/visitor/compare/visit_mut_span 188653 ns/iter (± 2400) 183641 ns/iter (± 792) 1.03
html/document/visitor/compare/visit_mut_span_panic 194130 ns/iter (± 7874) 188610 ns/iter (± 2453) 1.03
html/document/visitor/compare/fold_span 233871 ns/iter (± 1338) 231920 ns/iter (± 1219) 1.01
html/document/visitor/compare/fold_span_panic 287066 ns/iter (± 872) 279060 ns/iter (± 1331) 1.03
html/document_fragment/visitor/compare/clone 169980 ns/iter (± 2145) 167785 ns/iter (± 804) 1.01
html/document_fragment/visitor/compare/visit_mut_span 187422 ns/iter (± 1380) 183343 ns/iter (± 831) 1.02
html/document_fragment/visitor/compare/visit_mut_span_panic 191641 ns/iter (± 765) 188505 ns/iter (± 1085) 1.02
html/document_fragment/visitor/compare/fold_span 235679 ns/iter (± 903) 231763 ns/iter (± 3890) 1.02
html/document_fragment/visitor/compare/fold_span_panic 281909 ns/iter (± 1155) 277897 ns/iter (± 1144) 1.01
html/lexer/css_2021_spec 12929826 ns/iter (± 74872) 12885187 ns/iter (± 173672) 1.00
html/lexer/github_com_17_05_2022 4934252 ns/iter (± 4773) 4913665 ns/iter (± 14186) 1.00
html/lexer/stackoverflow_com_17_05_2022 4697624 ns/iter (± 3966) 4672610 ns/iter (± 8007) 1.01
html/parser/parser_document/css_2021_spec 26120252 ns/iter (± 422636) 25570717 ns/iter (± 283376) 1.02
html/parser/parser_document/github_com_17_05_2022 8716306 ns/iter (± 27645) 8590929 ns/iter (± 54017) 1.01
html/parser/parser_document/stackoverflow_com_17_05_2022 7610070 ns/iter (± 6666) 7368971 ns/iter (± 9823) 1.03
html/parser/parser_document_fragment/css_2021_spec 26036969 ns/iter (± 44590) 25134909 ns/iter (± 33705) 1.04
html/parser/parser_document_fragment/github_com_17_05_2022 8711680 ns/iter (± 12482) 8515081 ns/iter (± 28817) 1.02
html/parser/parser_document_fragment/stackoverflow_com_17_05_2022 7650312 ns/iter (± 8346) 7324374 ns/iter (± 8614) 1.04

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

Please sign in to comment.