perf(linter/plugins): reduce size of walker code#17176
Merged
graphite-app[bot] merged 1 commit intomainfrom Dec 20, 2025
Merged
perf(linter/plugins): reduce size of walker code#17176graphite-app[bot] merged 1 commit intomainfrom
graphite-app[bot] merged 1 commit intomainfrom
Conversation
This was referenced Dec 20, 2025
Member
Author
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements a performance optimization in the code generator for AST walker functions. By hoisting the enter variable declaration out of the if block and combining it with the exit declaration, the minifier can more effectively optimize the code, resulting in smaller bundled output.
- Modifies the Rust code generator template to declare
enterat function scope instead of block scope - Updates all generated JavaScript walker functions in two files to apply this optimization consistently
Reviewed changes
Copilot reviewed 1 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
tasks/ast_tools/src/generators/estree_visit.rs |
Updates the code generation template to hoist enter variable declaration, combining it with exit in a single declaration statement |
napi/parser/src-js/generated/visit/walk.js |
Regenerated walker functions with the optimized variable declaration pattern applied to all non-leaf node walkers |
apps/oxlint/src-js/generated/walk.js |
Regenerated walker functions with the optimized variable declaration pattern applied to all non-leaf node walkers |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Member
Author
Merge activity
|
By hoisting `let enter;` up out of the the `if` block, minifier is able to convert the `if` statement into a `&&` expression, resulting in tighter minified output. This optimization is only visible in the bundled output, as that's where we do more aggressive minification.
91eb2d2 to
1956664
Compare
5065ba8 to
5aefb84
Compare
Base automatically changed from
om/12-20-refactor_linter_plugins_parser_napi_add_jsdoc_comments_to_generated_code
to
main
December 20, 2025 14:09
This was referenced Dec 22, 2025
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.

By hoisting
let enter;up out of the theifblock, minifier is able to convert theifstatement into a&&expression, resulting in tighter minified output.This optimization is only visible in the bundled output, as that's where we do more aggressive minification.