Repository navigation
Conversation
Replaced an O(N) traversal of the document with `findNext()` with an O(1) lookup using the pre-computed `getMatchHighlights` DecorationSet from `prosemirror-search`. This significantly speeds up counting search results, particularly for large documents or frequent re-evaluations. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
Comment |
Replaced an O(N) traversal of the document with `findNext()` with an O(1) lookup using the pre-computed `getMatchHighlights` DecorationSet from `prosemirror-search`. This significantly speeds up counting search results, particularly for large documents or frequent re-evaluations. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com>
Replaced an O(N) traversal of the document with `findNext()` with an O(1) lookup using the pre-computed `getMatchHighlights` DecorationSet from `prosemirror-search`. This significantly speeds up counting search results, particularly for large documents or frequent re-evaluations. Also fixed a cargo fmt issue in pkgs/id/src/blob_gate.rs. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com>
Replaced an O(N) traversal of the document with `findNext()` with an O(1) lookup using the pre-computed `getMatchHighlights` DecorationSet from `prosemirror-search`. This significantly speeds up counting search results, particularly for large documents or frequent re-evaluations. Also fixed a cargo fmt issue in pkgs/id/src/blob_gate.rs and removed .jules/bolt.md so that it won't cause CI failures with formatting. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com>
Replaced an O(N) traversal of the document with `findNext()` with an O(1) lookup using the pre-computed `getMatchHighlights` DecorationSet from `prosemirror-search`. This significantly speeds up counting search results, particularly for large documents or frequent re-evaluations. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com>
⚡ Bolt: Optimize search match counting
💡 What: Replaced iterative
findNext()traversal withgetMatchHighlights(view.state).find().length.🎯 Why:
countMatcheswas doing an O(N) manual traversal of the document usingfindNext()on every keystroke, which is inefficient. Theprosemirror-searchplugin already pre-computes aDecorationSetof all matches for highlighting, so we can just ask for its length in O(1) time.📊 Impact: Reduces search counting from O(N) to O(1), preventing main thread blocking during active typing while the search panel is open on large documents.
🔬 Measurement: Open search panel (Ctrl+F) and observe fast keystrokes update the match count instantly without noticeable lag. Can be verified via
bun run testlocally which passes.PR created automatically by Jules for task 222071485066273284 started by @dezren39