Skip to content

Commit

Permalink
refactor(es/parser): Simplify skip_line_comment (#2768)
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxGraey authored Nov 17, 2021
1 parent 6ce437d commit 1bb2c68
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions crates/swc_ecma_parser/src/lexer/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,14 +220,9 @@ impl<'a, I: Input> Lexer<'a, I> {
self.bump();
if c.is_line_terminator() {
self.state.had_line_break = true;
}
match c {
'\n' | '\r' | '\u{2028}' | '\u{2029}' => {
break;
}
_ => {
end = self.cur_pos();
}
break;
} else {
end = self.cur_pos();
}
}

Expand Down

1 comment on commit 1bb2c68

@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: 1bb2c68 Previous: 6ce437d Ratio
base_tr_fixer 23335 ns/iter (± 232) 35378 ns/iter (± 5383) 0.66
base_tr_resolver_and_hygiene 125963 ns/iter (± 23945) 194961 ns/iter (± 27788) 0.65
codegen_es2015 51577 ns/iter (± 253) 68396 ns/iter (± 6819) 0.75
codegen_es2016 51324 ns/iter (± 285) 68338 ns/iter (± 7033) 0.75
codegen_es2017 51783 ns/iter (± 247) 69216 ns/iter (± 7510) 0.75
codegen_es2018 51908 ns/iter (± 246) 69694 ns/iter (± 6656) 0.74
codegen_es2019 51633 ns/iter (± 233) 67891 ns/iter (± 5842) 0.76
codegen_es2020 51753 ns/iter (± 332) 69289 ns/iter (± 5179) 0.75
codegen_es3 51778 ns/iter (± 403) 69361 ns/iter (± 10621) 0.75
codegen_es5 51599 ns/iter (± 372) 69015 ns/iter (± 15115) 0.75
full_es2015 182670883 ns/iter (± 7831354) 235518605 ns/iter (± 17310459) 0.78
full_es2016 142148762 ns/iter (± 4128963) 184979341 ns/iter (± 16284344) 0.77
full_es2017 148019910 ns/iter (± 7766400) 193977540 ns/iter (± 14590208) 0.76
full_es2018 147396045 ns/iter (± 6733222) 195894555 ns/iter (± 13809066) 0.75
full_es2019 146032775 ns/iter (± 6376068) 186785963 ns/iter (± 14867645) 0.78
full_es2020 145541103 ns/iter (± 5665417) 190738579 ns/iter (± 17098400) 0.76
full_es3 212734661 ns/iter (± 17296168) 284791411 ns/iter (± 31959208) 0.75
full_es5 197607775 ns/iter (± 13357034) 259355180 ns/iter (± 29886583) 0.76
parser 649690 ns/iter (± 25512) 889097 ns/iter (± 117341) 0.73
ser_ast_node 144 ns/iter (± 5) 197 ns/iter (± 14) 0.73
ser_serde 159 ns/iter (± 6) 206 ns/iter (± 18) 0.77
emit_colors 17856085 ns/iter (± 23363997) 14517344 ns/iter (± 20061908) 1.23
emit_large 115888976 ns/iter (± 174868657) 83824398 ns/iter (± 109478499) 1.38
base_clone 2250283 ns/iter (± 64102) 2970085 ns/iter (± 340892) 0.76
fold_span 3783608 ns/iter (± 151795) 5259444 ns/iter (± 997480) 0.72
fold_span_panic 4026843 ns/iter (± 202760) 5422115 ns/iter (± 660872) 0.74
visit_mut_span 2744706 ns/iter (± 88733) 3546297 ns/iter (± 579227) 0.77
visit_mut_span_panic 2808982 ns/iter (± 94796) 3619833 ns/iter (± 503362) 0.78
ast_clone 16993 ns/iter (± 239) 24238 ns/iter (± 1825) 0.70
ast_clone_to_stable 50916 ns/iter (± 428) 79513 ns/iter (± 10026) 0.64
ast_clone_to_stable_then_to_unstable 92306 ns/iter (± 441) 141641 ns/iter (± 11793) 0.65
json_deserialize 1926091 ns/iter (± 2124) 2828142 ns/iter (± 372694) 0.68
json_serialize 92502 ns/iter (± 158) 119158 ns/iter (± 12145) 0.78
boxing_boxed 142 ns/iter (± 0) 188 ns/iter (± 16) 0.76
boxing_boxed_clone 68 ns/iter (± 1) 83 ns/iter (± 9) 0.82
boxing_unboxed 129 ns/iter (± 0) 200 ns/iter (± 20) 0.65
boxing_unboxed_clone 64 ns/iter (± 0) 84 ns/iter (± 7) 0.76

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

Please sign in to comment.