perf(parser): inline end_span and parse_identifier_kind which are on the hot path (#2612)

This commit is contained in:
Boshen 2024-03-05 15:39:53 +08:00 committed by GitHub
parent 49778abb80
commit bf42158ad7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 4 deletions

View file

@ -146,8 +146,8 @@ opt-level = 'z'
opt-level = 3 opt-level = 3
lto = "fat" lto = "fat"
codegen-units = 1 codegen-units = 1
strip = "symbols" strip = false
debug = false debug = true
panic = "abort" # Let it crash and force ourselves to write safe Rust. panic = "abort" # Let it crash and force ourselves to write safe Rust.
# Use the `--profile release-debug` flag to show symbols in release mode. # Use the `--profile release-debug` flag to show symbols in release mode.

View file

@ -24,8 +24,8 @@ impl<'a> ParserImpl<'a> {
Span::new(token.start, 0) Span::new(token.start, 0)
} }
pub(crate) fn end_span(&self, span: Span) -> Span { #[inline]
let mut span = span; pub(crate) fn end_span(&self, mut span: Span) -> Span {
span.end = self.prev_token_end; span.end = self.prev_token_end;
span span
} }

View file

@ -102,6 +102,7 @@ impl<'a> ParserImpl<'a> {
IdentifierName { span, name } IdentifierName { span, name }
} }
#[inline]
pub(crate) fn parse_identifier_kind(&mut self, kind: Kind) -> (Span, Atom<'a>) { pub(crate) fn parse_identifier_kind(&mut self, kind: Kind) -> (Span, Atom<'a>) {
let span = self.start_span(); let span = self.start_span();
let name = self.cur_string(); let name = self.cur_string();