Skip to content

⚡ Bolt: Add itemPathBitflags for O(1) path fuzzy matching early-exit#560

Closed
AhmmedSamier wants to merge 1 commit into
masterfrom
jules-16870263683354084997-646a4f46
Closed

⚡ Bolt: Add itemPathBitflags for O(1) path fuzzy matching early-exit#560
AhmmedSamier wants to merge 1 commit into
masterfrom
jules-16870263683354084997-646a4f46

Conversation

@AhmmedSamier

@AhmmedSamier AhmmedSamier commented Jul 9, 2026

Copy link
Copy Markdown
Owner

💡 What

Added an O(1) bitflag early-exit check for path property fuzzy matching by maintaining a parallel itemPathBitflags array.

🎯 Why

Checking itemBitflags is an effective early exit for aggregated matches, but when falling back to tryFuzzyMatchPath, the evaluation proceeds directly to expensive Fuzzysort.single() string operations. Missing an explicit path bitflag check results in wasted fuzzy search cycles when characters are in other fields.

📊 Impact

Eliminates expensive function calls to Fuzzysort.single() in the tryFuzzyMatchPath hot path when the item's path does not contain the required query characters, reducing CPU load and speeding up fuzzy matching.

🔬 Measurement

Run bun run test to verify no functionality was broken. Benchmark fuzzy search times for queries containing characters not present in file paths.


PR created automatically by Jules for task 16870263683354084997 started by @AhmmedSamier

Summary by CodeRabbit

  • Performance Improvements

    • Faster fuzzy search matching, especially for path-based queries, by skipping unnecessary work earlier.
    • Search results may feel more responsive when typing or filtering large sets of items.
  • Bug Fixes

    • Improved handling of path matching so irrelevant items are filtered out sooner, reducing slowdowns during search.

Isolates and maintains an `itemPathBitflags` array in hot paths, parallel to `itemNameBitflags`, `itemFullNameBitflags`, and `itemBitflags`. Uses this specific bitmask to implement an O(1) early-exit check inside `tryFuzzyMatchPath` before executing expensive string evaluations.

Co-authored-by: AhmmedSamier <17784876+AhmmedSamier@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: d44a3000-4728-4cda-95da-afae3c7c4519

📥 Commits

Reviewing files that changed from the base of the PR and between 124aa21 and 723bf75.

📒 Files selected for processing (2)
  • .jules/bolt.md
  • language-server/src/core/search-engine.ts

📝 Walkthrough

Walkthrough

Adds per-item path bitflags to the search index and uses them in tryFuzzyMatchPath to return -Infinity before expensive fuzzy scoring when query characters cannot occur in the path.

Changes

Path bitflag pruning

Layer / File(s) Summary
Path bitflag lifecycle
language-server/src/core/search-engine.ts
Adds itemPathBitflags, computes path-specific flags, maintains them across indexing and removals, and includes them in reset and cache-size handling.
Search context and path matching
language-server/src/core/search-engine.ts, .jules/bolt.md
Exposes path flags to the search context and applies a containment check in tryFuzzyMatchPath before prepared path fuzzy matching; documents the change.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Suggested labels: codex

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: adding itemPathBitflags for an O(1) early-exit in path fuzzy matching.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jules-16870263683354084997-646a4f46

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant