Skip to content

Conversation

@lilnasy
Copy link
Contributor

@lilnasy lilnasy commented Oct 19, 2025

Part of #14564. Binary search is used to traverse the comments array wherever possible.

  • getCommentsBefore
  • getCommentsAfter
  • getCommentsInside
  • commentsExistBetween

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 19, 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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI C-performance Category - Solution not expected to change functional behavior, only performance labels Oct 19, 2025
@lilnasy lilnasy force-pushed the perf/linter/plugins branch from bb606a9 to 0a1d767 Compare October 19, 2025 13:56
@lilnasy lilnasy marked this pull request as ready for review October 19, 2025 14:37
@lilnasy lilnasy requested a review from camc314 as a code owner October 19, 2025 14:37
Copilot AI review requested due to automatic review settings October 19, 2025 14:37
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 comment traversal functions in the linter's comments plugin by replacing linear search algorithms with binary search. This improves performance from O(n) to O(log n) for finding comments relative to AST nodes.

  • Binary search implementation for finding comments before, after, and inside nodes
  • Optimization of the commentsExistBetween function with binary search
  • Improved algorithmic efficiency while maintaining the same functionality

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lilnasy lilnasy force-pushed the perf/linter/plugins branch from c3e8ba4 to 10f1ed5 Compare October 19, 2025 18:16
Copy link
Contributor

@camc314 camc314 left a comment

Choose a reason for hiding this comment

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

thank you!

@camc314 camc314 merged commit 10182e8 into oxc-project:main Oct 20, 2025
18 checks passed
@lilnasy lilnasy deleted the perf/linter/plugins branch October 20, 2025 08:12
@camc314 camc314 self-assigned this Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI 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