Skip to content

Commit

Permalink
perf(parser): inline identifier handler into byte handlers
Browse files Browse the repository at this point in the history
  • Loading branch information
overlookmotel committed Feb 15, 2024
1 parent 3ff3495 commit ce74089
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crates/oxc_parser/src/lexer/identifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ impl<'a> Lexer<'a> {
/// # SAFETY
/// * `self.source` must not be exhausted (at least 1 char remaining).
/// * Next char must be ASCII.
#[allow(clippy::missing_safety_doc)] // Clippy is wrong!
// Clippy is wrong!
#[allow(clippy::missing_safety_doc)]
// Inline into all identifier byte handlers, which avoids a function call on a hot path.
// NB: `#[inline]` is not sufficient to force compiler to inline.
#[allow(clippy::inline_always)]
#[inline(always)]
pub(super) unsafe fn identifier_name_handler(&mut self) -> &'a str {
// Advance past 1st byte.
// SAFETY: Caller guarantees not at EOF, and next byte is ASCII.
Expand Down

0 comments on commit ce74089

Please sign in to comment.