Skip to content

⚡ Bolt: [Fast query evaluation for burst search]#453

Merged
AhmmedSamier merged 2 commits into
masterfrom
bolt/fast-query-burst-search-12884279658640324908
May 22, 2026
Merged

⚡ Bolt: [Fast query evaluation for burst search]#453
AhmmedSamier merged 2 commits into
masterfrom
bolt/fast-query-burst-search-12884279658640324908

Conversation

@AhmmedSamier

@AhmmedSamier AhmmedSamier commented May 20, 2026

Copy link
Copy Markdown
Owner

💡 What: Implemented an O(1) character bitmask check in the findBurstMatches fallback hot loop by precomputing queryBitflags and checking it against itemBitflags before performing any string allocations.
🎯 Why: To immediately bypass items that are impossible to match during the exhaustive "burst search" pass, saving significant CPU cycles that were previously wasted instantiating strings via toLowerCase() and running .indexOf().
📊 Impact: Substantially reduces the duration of "No match" and low-match fallback passes. Benchmarks show the "No Match" scenario dropping from ~42ms to ~1.3ms.
🔬 Measurement: Execute cd language-server && bun run benchmarks/search_burst.bench.ts.


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

Summary by CodeRabbit

  • Refactor

    • Optimized search filtering for improved performance.
  • Chores

    • Added benchmark measurements across multiple search scenarios.
  • Documentation

    • Updated performance guidance notes for search optimization.

Review Change Stack

Precomputes queryBitflags outside the hot loop in `findBurstMatches` and applies a fast O(1) bitwise early-exit check to bypass items lacking the required query characters. This avoids redundant string allocations and `.indexOf` checks, significantly boosting performance (e.g., from ~42ms to ~1.3ms) for searches yielding zero or few matches in the exhaustive fallback pass.

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.

@coderabbitai

coderabbitai Bot commented May 20, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • .opencode/package-lock.json is excluded by !**/package-lock.json

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f729168b-9e53-4f74-9e9a-b9fc5fe97e72

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

This PR optimizes burstSearch in the language server by adding a bitflag-based prefilter that skips incompatible items before score calculation. The optimization is implemented in search-engine.ts, documented in the bolt journal, and validated with benchmark timing results.

Changes

Burst Search Bitflag Prefilter

Layer / File(s) Summary
Bitflag prefilter in burstSearch
language-server/src/core/search-engine.ts
burstSearch precomputes queryBitflags once and adds an early-exit check using itemBitflags containment before calling processItem, eliminating unnecessary string work for incompatible candidates.
Performance documentation and benchmark results
.jules/bolt.md, language-server/benchmarks/results_burst.json
Bolt journal entry documents the O(1) bitwise early-exit optimization; benchmark file records timing metrics across three test scenarios (App match, Zzz no-match, S many-matches).

Possibly related PRs

  • AhmmedSamier/DeepLens#256: Implements the same bitflag-based early-exit prefilter in burstSearch with identical queryBitflags and itemBitflags masking logic.
  • AhmmedSamier/DeepLens#253: Updates burstSearch/findBurstMatches processItem logic with query/item bitflag prefiltering for early skipping before scoring.
  • AhmmedSamier/DeepLens#438: Changes burstSearch item-scanning pipeline with refactoring and scoring helpers that overlap at the hot-path logic level.

Suggested labels

codex

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes


🐰 A flag of bits now stands so tall,
Pre-filtering all before the call,
No scoring for items that don't fit the query,
Swift as a hare, no need to worry!

🚥 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 references a performance optimization for burst search query evaluation, which directly aligns with the core change of adding a fast bitflag prefilter to skip incompatible items.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt/fast-query-burst-search-12884279658640324908

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 and usage tips.

@AhmmedSamier
AhmmedSamier merged commit b22df34 into master May 22, 2026
6 checks passed
@AhmmedSamier
AhmmedSamier deleted the bolt/fast-query-burst-search-12884279658640324908 branch May 22, 2026 20:59
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