Skip to content

perf(linter/plugins): reduce operations in binary search#20490

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/03-18-perf_linter_plugins_reduce_operations_in_binary_search
Mar 21, 2026
Merged

perf(linter/plugins): reduce operations in binary search#20490
graphite-app[bot] merged 1 commit intomainfrom
om/03-18-perf_linter_plugins_reduce_operations_in_binary_search

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Mar 18, 2026

Tiny optimization. Use 1 less operation in binary search when converting offset to line-column pair.

Copy link
Member Author

overlookmotel commented Mar 18, 2026


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 changes, fast-track this PR to the front of the merge queue

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.

@overlookmotel overlookmotel self-assigned this Mar 18, 2026
@overlookmotel overlookmotel force-pushed the om/03-17-perf_linter_plugins_reduce_allocations_for_tokens_and_comments_with_accessed_loc_ branch from c659d44 to 66d228c Compare March 18, 2026 16:28
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_reduce_operations_in_binary_search branch from 569fde7 to 5c85a67 Compare March 18, 2026 16:28
@overlookmotel overlookmotel marked this pull request as ready for review March 18, 2026 19:04
@overlookmotel overlookmotel requested a review from camc314 as a code owner March 18, 2026 19:04
Copilot AI review requested due to automatic review settings March 18, 2026 19:04
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 introduces a micro-optimization in the linter’s source-location utilities by changing the binary search midpoint calculation used when converting an offset into a line/column position.

Changes:

  • Replace midpoint computation from division-based floor to bitshift-based midpoint in getLineColumnFromOffsetUnchecked.

@overlookmotel overlookmotel removed the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Mar 20, 2026

Merge activity

@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Mar 20, 2026 — with Graphite App
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_reduce_operations_in_binary_search branch from cea62d4 to 7de6e14 Compare March 21, 2026 12:21
@overlookmotel overlookmotel force-pushed the om/03-17-perf_linter_plugins_reduce_allocations_for_tokens_and_comments_with_accessed_loc_ branch 2 times, most recently from d825833 to 72d4da3 Compare March 21, 2026 12:32
@overlookmotel overlookmotel force-pushed the om/03-18-perf_linter_plugins_reduce_operations_in_binary_search branch from 7de6e14 to 2be5b0a Compare March 21, 2026 12:32
Tiny optimization. Use 1 less operation in binary search when converting offset to line-column pair.
@graphite-app graphite-app bot force-pushed the om/03-17-perf_linter_plugins_reduce_allocations_for_tokens_and_comments_with_accessed_loc_ branch from 72d4da3 to 9cfc312 Compare March 21, 2026 12:48
@graphite-app graphite-app bot force-pushed the om/03-18-perf_linter_plugins_reduce_operations_in_binary_search branch from 2be5b0a to 8729614 Compare March 21, 2026 12:48
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 21, 2026
Base automatically changed from om/03-17-perf_linter_plugins_reduce_allocations_for_tokens_and_comments_with_accessed_loc_ to main March 21, 2026 12:52
@graphite-app graphite-app bot merged commit 8729614 into main Mar 21, 2026
24 checks passed
@graphite-app graphite-app bot deleted the om/03-18-perf_linter_plugins_reduce_operations_in_binary_search branch March 21, 2026 12:52
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 A-linter-plugins Area - Linter JS plugins 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