Skip to content

⚡ Bolt: [performance improvement] Optimize unique tracking in search fallback#425

Open
AhmmedSamier wants to merge 1 commit intomasterfrom
bolt-search-remaining-optimization-12556550429143644537
Open

⚡ Bolt: [performance improvement] Optimize unique tracking in search fallback#425
AhmmedSamier wants to merge 1 commit intomasterfrom
bolt-search-remaining-optimization-12556550429143644537

Conversation

@AhmmedSamier
Copy link
Copy Markdown
Owner

💡 What
Replaced a dynamic Uint8Array allocation (new Uint8Array(this.items.length)) in SearchEngine.searchRemainingItems with an $O(1)$ constant-time lookup mapped via a static 256-byte array (skipTypeId).

🎯 Why
Inside a performance-critical fallback search pass, the original code instantiated a large array proportional to the entire workspace size (e.g. 50,000+ items) on every call to track which scopes to skip. This caused severe allocation overhead and Garbage Collection (GC) pauses, throttling the burst search.

📊 Impact

  • No Match ("Zzz") Burst Search: Average latency reduced by ~50% (from ~40.3ms to ~19.1ms).
  • GC Pressure: Completely eliminates the $O(N)$ memory allocations inside the priority scope fallback tracking.

🔬 Measurement
Verify via the burst search benchmarks: cd language-server && bun run benchmarks/search_burst.bench.ts.


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

…mainingItems

Replaced the dynamic O(N) Uint8Array allocation in searchRemainingItems with a static O(1) mapping of priorityScopes to type IDs. This eliminates significant array allocation overhead and looping setup, reducing GC pressure and drastically improving burst search performance for unmatched queries (Zzz baseline reduced from ~40ms to ~19ms).

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
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 10, 2026

Warning

Rate limit exceeded

@AhmmedSamier has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 33 minutes and 4 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b7d5e92e-cb98-41ca-987a-323b8ce7cc2c

📥 Commits

Reviewing files that changed from the base of the PR and between 82edc2d and 206f366.

📒 Files selected for processing (5)
  • .jules/bolt.md
  • language-server/benchmarks/results_burst.json
  • language-server/src/core/indexer-worker.ts
  • language-server/src/core/search-engine.ts
  • language-server/src/core/workspace-indexer.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bolt-search-remaining-optimization-12556550429143644537

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.

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