From 1cebae39146453afe468f638537c99d182c44897 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:26:48 +0000 Subject: [PATCH 1/3] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20search=20mat?= =?UTF-8?q?ch=20counting=20performance?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use `getMatchHighlights` to quickly count matches instead of re-evaluating the full document layout via `findNext`. This transforms an $O(N)$ document scan operation into an $O(M)$ operation where $M$ is the number of results, avoiding blocking the main thread significantly. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com> --- pkgs/id/web/src/search-panel.ts | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/pkgs/id/web/src/search-panel.ts b/pkgs/id/web/src/search-panel.ts index 4313cda0..1ec8d362 100644 --- a/pkgs/id/web/src/search-panel.ts +++ b/pkgs/id/web/src/search-panel.ts @@ -14,6 +14,7 @@ import { keymap } from "prosemirror-keymap"; import { findNext, findPrev, + getMatchHighlights, getSearchState, replaceAll, replaceNext, @@ -54,15 +55,10 @@ function countMatches(view: EditorView): number { const ss = getSearchState(view.state); if (!ss || !ss.query.valid) return 0; - let count = 0; - let result = ss.query.findNext(view.state, 0); - const seen = new Set(); - while (result && !seen.has(result.from)) { - seen.add(result.from); - count++; - result = ss.query.findNext(view.state, result.to); - } - return count; + // ⚡ Bolt Optimization: Use pre-calculated decorations instead of traversing the document again + // The prosemirror-search plugin already finds all matches and stores them as decorations. + // getMatchHighlights(...).find().length is O(M) (where M is number of matches) compared to O(N) (N = doc size) for the previous loop traversal. + return getMatchHighlights(view.state).find().length; } /** Update match count label. */ From f604b461b66b4e6428a99318fcf47bc886c9febb Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 01:31:22 +0000 Subject: [PATCH 2/3] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20search=20mat?= =?UTF-8?q?ch=20counting=20performance=20and=20fix=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use getMatchHighlights to quickly count matches instead of re-evaluating the full document layout via findNext. This transforms an O(N) document scan operation into an O(M) operation where M is the number of results, avoiding blocking the main thread significantly. Also updates the pozil/auto-assign-issue action to v2 in order to fix the Node 20 deprecation warning and execution errors in CI. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com> --- .github/workflows/auto-assign.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/auto-assign.yml b/.github/workflows/auto-assign.yml index e4ea3673..dc125522 100755 --- a/.github/workflows/auto-assign.yml +++ b/.github/workflows/auto-assign.yml @@ -12,7 +12,7 @@ jobs: pull-requests: write steps: - name: 'Auto-assign issue' - uses: pozil/auto-assign-issue@v1 + uses: pozil/auto-assign-issue@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} assignees: dezren39 From dababf30072d66b15c86e24ee2b3157fff4807fa Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 7 Oct 2026 02:12:19 +0000 Subject: [PATCH 3/3] =?UTF-8?q?=E2=9A=A1=20Bolt:=20Optimize=20search=20mat?= =?UTF-8?q?ch=20counting=20performance=20and=20fix=20CI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use getMatchHighlights to quickly count matches instead of re-evaluating the full document layout via findNext. This transforms an O(N) document scan operation into an O(M) operation where M is the number of results, avoiding blocking the main thread significantly. Updates the pozil/auto-assign-issue action to v2 in order to fix the Node 20 deprecation warning and execution errors in CI. Fixes permissions on cargoDeps inside flake.nix to prevent libsql-ffi build.rs from failing during build. Co-authored-by: dezren39 <11225574+dezren39@users.noreply.github.com> --- pkgs/id/flake.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/pkgs/id/flake.nix b/pkgs/id/flake.nix index b6c90420..6533c2c6 100644 --- a/pkgs/id/flake.nix +++ b/pkgs/id/flake.nix @@ -109,7 +109,10 @@ export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" # Configure cargo to use vendored dependencies (nix sandbox has no network) - cat >> .cargo/config.toml << EOF + export SQLITE3_DIR="${cargoDeps}/libsql-ffi-0.5.0/sqlite3" + export CC_x86_64_unknown_linux_gnu="gcc" + chmod -R +w ${cargoDeps} || true + cat >> .cargo/config.toml << EOF [source.crates-io] replace-with = "vendored-sources" @@ -191,6 +194,9 @@ export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" # Configure cargo to use vendored dependencies (nix sandbox has no network) + export SQLITE3_DIR="${cargoDeps}/libsql-ffi-0.5.0/sqlite3" + export CC_x86_64_unknown_linux_gnu="gcc" + chmod -R +w ${cargoDeps} || true cat >> .cargo/config.toml << EOF [source.crates-io] @@ -363,6 +369,9 @@ export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}" # Configure cargo to use vendored dependencies (nix sandbox has no network) + export SQLITE3_DIR="${cargoDeps}/libsql-ffi-0.5.0/sqlite3" + export CC_x86_64_unknown_linux_gnu="gcc" + chmod -R +w ${cargoDeps} || true cat >> .cargo/config.toml << EOF [source.crates-io]