mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 04:08:41 +00:00
perf(semantic): inline ast record functions (#4272)
Inline these functions so that when CFG is disabled, it doesn't cost a function call just for the trivial `if self.cfg.is_some()` check. Based on @rzvxa's suggestion in https://github.com/oxc-project/oxc/pull/4263#pullrequestreview-2176762670.
This commit is contained in:
parent
9a87e41332
commit
f9d3f2ef55
1 changed files with 3 additions and 0 deletions
|
|
@ -249,12 +249,14 @@ impl<'a> SemanticBuilder<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn record_ast_nodes(&mut self) {
|
||||
if self.cfg.is_some() {
|
||||
self.ast_node_records.push(AstNodeId::dummy());
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
#[allow(clippy::unnecessary_wraps)]
|
||||
fn retrieve_recorded_ast_node(&mut self) -> Option<AstNodeId> {
|
||||
if self.cfg.is_some() {
|
||||
|
|
@ -264,6 +266,7 @@ impl<'a> SemanticBuilder<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn record_ast_node(&mut self) {
|
||||
if self.cfg.is_some() {
|
||||
if let Some(record) = self.ast_node_records.last_mut() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue