Skip to content

perf(browser-search): index hot query path#520

Closed
JustYannicc wants to merge 2 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-browser-search-indexed-harness
Closed

perf(browser-search): index hot query path#520
JustYannicc wants to merge 2 commits into
SuperCmdLabs:mainfrom
JustYannicc:codex/perf-browser-search-indexed-harness

Conversation

@JustYannicc

@JustYannicc JustYannicc commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

What changed

  • Added token-prefix, trigram, per-entry search, and bookmark nickname lookup data to the browser entry index.
  • Routed bookmark/history query candidate selection through indexed entry ID intersections, then kept the existing scoring and ordering checks as the source of truth.
  • Added a real synthetic browser search performance harness covering 24k history/bookmark rows, 300 tabs, nickname matches, full-scan parity, and generous query thresholds.

Why

Browser search was still scanning every history and bookmark entry for typed root queries even though an entry index existed. Large browser datasets could make each keystroke spend more than 100 ms in candidate generation.

Compatibility impact

Search result scoring, dedupe, completion, and ordering are preserved by verifying indexed candidates with the existing full scoring path. The code falls back to full scans when the query shape cannot be represented safely by the index. No user-facing strings or i18n keys changed.

How tested

  • Baseline before editing on synthetic 24,000 entries and 300 tabs: ranked avg 150.94-199.77 ms; ordered avg 173.56-224.59 ms.
  • Final harness on synthetic 24,001 entries and 300 tabs: index build 300.50 ms; ranked full-scan avg 133.60-160.05 ms; ranked indexed avg 1.44-14.03 ms; ordered full-scan avg 134.62-154.54 ms; ordered indexed avg 1.39-12.52 ms.
  • node --test scripts/test-browser-search-lag-fix.mjs scripts/test-browser-search-performance.mjs
  • node --test 'scripts/test-*.mjs'
  • ./node_modules/.bin/tsc -p tsconfig.main.json
  • ./node_modules/.bin/vite build
  • node scripts/check-i18n.mjs
  • Codex LSP diagnostics for src/renderer/src/hooks/useBrowserSearch.ts: no errors.

Stack validation

This issue was found and validated from codex/perf-integration-stack, which contains the current performance fix stack, including the renderer typecheck cleanup from #518. On that integrated branch, ./node_modules/.bin/tsc -p tsconfig.renderer.json --noEmit --pretty false, ./node_modules/.bin/tsc -p tsconfig.main.json --noEmit --pretty false, and node --test 'scripts/test-*.mjs' pass.

@JustYannicc

Copy link
Copy Markdown
Collaborator Author

Superseded by the consolidated upstream PR #535: #535

@JustYannicc JustYannicc closed this Jul 3, 2026
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