Skip to content

perf(linter/curly): avoid additional parent AST lookup#17222

Merged
graphite-app[bot] merged 1 commit intomainfrom
c/12-21-perf_linter_curly_avoid_parent_ast_lookup_by_passing_is_do_while_flag
Dec 21, 2025
Merged

perf(linter/curly): avoid additional parent AST lookup#17222
graphite-app[bot] merged 1 commit intomainfrom
c/12-21-perf_linter_curly_avoid_parent_ast_lookup_by_passing_is_do_while_flag

Conversation

@camc314
Copy link
Contributor

@camc314 camc314 commented Dec 21, 2025

Ref #17221

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

camc314 commented Dec 21, 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.

@camc314 camc314 self-assigned this Dec 21, 2025
@camc314 camc314 changed the title perf(linter/curly): avoid parent AST lookup by passing is_do_while flag perf(linter/curly): avoid additional parent AST lookup Dec 21, 2025
@camc314 camc314 marked this pull request as ready for review December 21, 2025 17:42
Copilot AI review requested due to automatic review settings December 21, 2025 17:42
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 21, 2025
Copy link
Contributor Author

camc314 commented Dec 21, 2025

Merge activity

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 optimizes the curly linter rule by eliminating an unnecessary parent AST lookup. Instead of querying the AST to determine if a statement is within a do-while loop, the code now passes this information as a boolean parameter derived from the keyword already available in the context.

  • Adds an is_do_while parameter to apply_rule_fix to avoid parent node lookup
  • Computes is_do_while from the existing keyword parameter using keyword == "do"
  • Removes the expensive ctx.nodes().parent_kind() call that was previously needed

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

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 21, 2025

CodSpeed Performance Report

Merging #17222 will not alter performance

Comparing c/12-21-perf_linter_curly_avoid_parent_ast_lookup_by_passing_is_do_while_flag (221607f) with main (951a2a2)

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 force-pushed the c/12-21-perf_linter_curly_avoid_parent_ast_lookup_by_passing_is_do_while_flag branch from 221607f to c48c406 Compare December 21, 2025 17:57
@graphite-app graphite-app bot merged commit c48c406 into main Dec 21, 2025
20 checks passed
@graphite-app graphite-app bot deleted the c/12-21-perf_linter_curly_avoid_parent_ast_lookup_by_passing_is_do_while_flag branch December 21, 2025 18:02
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 21, 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.

2 participants