mirror of
https://github.com/oxc-project/oxc.git
synced 2026-11-04 10:29:58 +00:00
perf(parser): specialize identifier reference parsing (#28303)
Inline identifier parsing and bypass async/contextual disambiguation for ordinary identifiers. Native parse time versus parent: 2.7% lower with fresh arenas, 2.3% lower with reuse (geometric mean, 12 files, arm64 macOS; 3 rounds × 100 samples). Validated existing Rust/Node suites, parser/ESTree/token conformance, allocation snapshots, and x86 compilation. AI-assisted implementation. Depends on #28302.
This commit is contained in:
1 parent
0d6641a113
commit
36669393e7
1 file changed
+4
@@ -263,6 +263,10 @@ impl<'a, C: Config> ParserImpl<'a, C> {
|
||||
/// `TemplateLiteral`[?Yield, ?Await, ~Tagged]
|
||||
/// `CoverParenthesizedExpressionAndArrowParameterList`[?Yield, ?Await]
|
||||
fn parse_primary_expression(&mut self) -> Expression<'a> {
|
||||
// Ordinary identifiers do not need async-function or contextual-keyword disambiguation.
|
||||
if self.at(Kind::Ident) {
|
||||
return self.parse_identifier_expression();
|
||||
}
|
||||
// FunctionExpression, GeneratorExpression
|
||||
// AsyncFunctionExpression, AsyncGeneratorExpression
|
||||
if self.at_function_with_async() {
|
||||
|
||||
Reference in new issue
Block a user