Skip to content

perf(linter/plugins): reduce size of walker code#17176

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-perf_linter_plugins_reduce_size_of_walker_code
Dec 20, 2025
Merged

perf(linter/plugins): reduce size of walker code#17176
graphite-app[bot] merged 1 commit intomainfrom
om/12-20-perf_linter_plugins_reduce_size_of_walker_code

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Dec 20, 2025

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.

Copy link
Member Author

overlookmotel commented Dec 20, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 enter at 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.

@overlookmotel overlookmotel self-assigned this Dec 20, 2025
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
Copy link
Member Author

overlookmotel commented Dec 20, 2025

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.
@graphite-app graphite-app bot force-pushed the om/12-20-refactor_linter_plugins_parser_napi_add_jsdoc_comments_to_generated_code branch from 91eb2d2 to 1956664 Compare December 20, 2025 14:02
@graphite-app graphite-app bot force-pushed the om/12-20-perf_linter_plugins_reduce_size_of_walker_code branch from 5065ba8 to 5aefb84 Compare December 20, 2025 14:02
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 20, 2025
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
@graphite-app graphite-app bot merged commit 5aefb84 into main Dec 20, 2025
19 checks passed
@graphite-app graphite-app bot deleted the om/12-20-perf_linter_plugins_reduce_size_of_walker_code branch December 20, 2025 14:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast-tools Area - AST tools A-cli Area - CLI A-linter Area - Linter A-linter-plugins Area - Linter JS plugins A-parser Area - Parser C-performance Category - Solution not expected to change functional behavior, only performance

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants