perf(semantic): #[inline] Scoping::get_binding#22414
Merged
Merged
Conversation
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Merging this PR will not alter performance
Comparing Footnotes
|
Member
Author
Merge activity
|
Member
Author
|
Small improvement |
`walk_up_resolve_reference` — the hot scope-chain walk in reference resolution — is `#[inline(always)]`, but it calls `Scoping::get_binding` which wasn't `#[inline]`. With `oxc_semantic` and `oxc_syntax` in separate crates and `borrow_dependent` from `self_cell`, the inliner wouldn't reach through the boundary without the hint, even under LTO. Adding `#[inline]` lets the caller inline through `borrow_dependent` + the indexed `FxHashMap` lookup as a single specialized path. Measured on `typescript.js` (7.83 MB, Microsoft/TypeScript bundle), M3-class machine, in-process semantic build: | Feature set | Baseline | With `#[inline]` | Speedup | |---|---|---|---| | no features | 1.034 s ± 0.014 | 1.010 s ± 0.008 | 1.02× (clean signal) | | `cfg,linter` (oxlint config) | 1.159 s ± 0.018 | 1.148 s ± 0.010 | 1.01× ± 0.02 (within noise) | Sub-2% in the lightweight config; noise-level under `cfg,linter` because per-node bookkeeping (`AstTypesBitset::set`, CFG block tracking) dominates there. Shipping anyway since the change is a single-attribute hint with no API or behavior change — costs nothing if the inliner ignores it. Verified by `cargo test -p oxc_semantic --features cfg,linter` (98 tests), `cargo test -p oxc_linter --lib` (1119 tests). AI assisted.
65d2d7b to
ce92c6c
Compare
camc314
pushed a commit
that referenced
this pull request
May 18, 2026
### 🐛 Bug Fixes - 0f26de6 ecmascript: Resolve identifier value type via tracked constants (#22234) (Alexander Lichter) - c27a8cf minifier: Normalize `{ x: x }` shorthand so adjacent-if merge is idempotent (#22401) (Dunqing) - e431a0e parser: Break extends clause loop on fatal error (#22517) (Boshen) - e9ec7c6 minifier: Fold optional chains by base nullishness (#22236) (Alexander Lichter) - e6090e7 transformer: Keep enum IIFE when a non-inlinable value reference remains (#22501) (Dunqing) - 931b7d6 transformer: Inline const enum members through type-cast wrappers (#22500) (Dunqing) - b9615b2 codegen: Preserve string quotes in require() calls during minification (#22475) (zennnnnnn11) - c73c159 transformer/async-to-generator: Reparent parameter initializer scopes (#22507) (camc314) - ecfd3ca transformer/async-to-generator: Move only parameter bindings (#22503) (camc314) - 3ce3431 transformer/explicit-resource-managment: Preserve shadowed for-head block (#22451) (camc314) ### ⚡ Performance - ce92c6c semantic: `#[inline]` `Scoping::get_binding` (#22414) (Dunqing) - 98be95c regular_expression: Track regex flags via bitflags (#22427) (Boshen) - dbbc059 jsdoc: Skip should_attach_jsdoc when no remaining comments (#22409) (Boshen) - 217d7d8 minifier: Index `SymbolValues` by `SymbolId` (#22441) (Dunqing) - d782b78 minifier: Use BitSet for LiveUsageCollector live references (#22425) (Boshen)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

walk_up_resolve_reference— the hot scope-chain walk in reference resolution — is#[inline(always)], but it callsScoping::get_bindingwhich wasn't#[inline]. Withoxc_semanticandoxc_syntaxin separate crates andborrow_dependentfromself_cell, the inliner wouldn't reach through the boundary without the hint, even under LTO.Adding
#[inline]lets the caller inline throughborrow_dependent+ the indexedFxHashMaplookup as a single specialized path.Measured on
typescript.js(7.83 MB, Microsoft/TypeScript bundle), M3-class machine, in-process semantic build:#[inline]cfg,linter(oxlint config)Sub-2% in the lightweight config; noise-level under
cfg,linterbecause per-node bookkeeping (AstTypesBitset::set, CFG block tracking) dominates there. Shipping anyway since the change is a single-attribute hint with no API or behavior change — costs nothing if the inliner ignores it.Verified by
cargo test -p oxc_semantic --features cfg,linter(98 tests),cargo test -p oxc_linter --lib(1119 tests).AI assisted.