Skip to content

perf(linter): inline is_function_node into run functions#17373

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-24-perf_linter_inline_is_function_node_into_run_functions
Dec 27, 2025
Merged

perf(linter): inline is_function_node into run functions#17373
graphite-app[bot] merged 1 commit intomainfrom
12-24-perf_linter_inline_is_function_node_into_run_functions

Conversation

@camchenry
Copy link
Member

@camchenry camchenry commented Dec 26, 2025

Inlining the is_function_node function allows the linter codegen to do the static analysis more easily. I suppose this is slightly negative towards less maintainability, but I don't expect we'll have more types of functions added to JS anytime soon. And the +1-2% improvement is hard to pass up for being so easy:

image

Copy link
Member Author

camchenry commented Dec 26, 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.

@github-actions github-actions bot added A-linter Area - Linter C-performance Category - Solution not expected to change functional behavior, only performance labels Dec 26, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 26, 2025

CodSpeed Performance Report

Merging #17373 will not alter performance

Comparing 12-24-perf_linter_inline_is_function_node_into_run_functions (23857c2) with main (445ff9e)

Summary

✅ 4 untouched
⏩ 41 skipped1

Footnotes

  1. 41 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@graphite-app graphite-app bot changed the base branch from 12-23-perf_linter_no-multi-str_skip_searching_strings_when_in_jsx_attribute to graphite-base/17373 December 26, 2025 16:33
@graphite-app graphite-app bot force-pushed the 12-24-perf_linter_inline_is_function_node_into_run_functions branch from 542b761 to 571e6dc Compare December 26, 2025 16:38
@graphite-app graphite-app bot force-pushed the graphite-base/17373 branch from 120c867 to d2abc78 Compare December 26, 2025 16:38
@graphite-app graphite-app bot changed the base branch from graphite-base/17373 to main December 26, 2025 16:39
@graphite-app graphite-app bot force-pushed the 12-24-perf_linter_inline_is_function_node_into_run_functions branch from 571e6dc to e188d8c Compare December 26, 2025 16:39
@camchenry camchenry marked this pull request as ready for review December 27, 2025 01:56
@camchenry camchenry requested a review from camc314 as a code owner December 27, 2025 01:56
Copilot AI review requested due to automatic review settings December 27, 2025 01:56
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 aims to improve linter performance by 1-2% by inlining the is_function_node helper function directly into the run methods of two rules, allowing the linter codegen to perform better static analysis and optimize node type filtering.

Key changes:

  • Inlined function node type checks in max_nested_callbacks and max_lines_per_function rules
  • Updated generated code to specify NODE_TYPES bitsets for more efficient node filtering
  • Removed is_function_node import from the affected rules

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 1 comment.

File Description
crates/oxc_linter/src/rules/eslint/max_nested_callbacks.rs Inlined function node checks at the start of run() and removed is_function_node check from is_callback() helper
crates/oxc_linter/src/rules/eslint/max_lines_per_function.rs Inlined function node checks at the start of run() and removed is_function_node import
crates/oxc_linter/src/generated/rule_runner_impls.rs Updated NODE_TYPES to filter for Function and ArrowFunctionExpression types

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@camchenry camchenry force-pushed the 12-24-perf_linter_inline_is_function_node_into_run_functions branch from e188d8c to 23857c2 Compare December 27, 2025 02:42
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 27, 2025
Copy link
Contributor

camc314 commented Dec 27, 2025

Merge activity

Inlining the `is_function_node` function allows the linter codegen to do the static analysis more easily. I suppose this is slightly negative towards less maintainability, but I don't expect we'll have more types of functions added to JS anytime soon. And the +1-2% improvement is hard to pass up for being so easy:

<img width="723" height="436" alt="image" src="https://github.com/user-attachments/assets/7612c36e-3006-4cea-a038-d0e9b027ee04" />
@graphite-app graphite-app bot force-pushed the 12-24-perf_linter_inline_is_function_node_into_run_functions branch from 23857c2 to eecee5d Compare December 27, 2025 11:52
@graphite-app graphite-app bot merged commit eecee5d into main Dec 27, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 12-24-perf_linter_inline_is_function_node_into_run_functions branch December 27, 2025 11:57
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter 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.

3 participants