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
lto = "fat"
codegen-units = 1
strip = "symbols"
debug = false
strip = false
debug = true
panic = "abort" # Let it crash and force ourselves to write safe Rust.
# 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)
}
pub(crate) fn end_span(&self, span: Span) -> Span {
let mut span = span;
#[inline]
pub(crate) fn end_span(&self, mut span: Span) -> Span {
span.end = self.prev_token_end;
span
}

View file

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