Skip to content

fix(cursor): cache global DB snapshot and batch bubble lookups on import#19

Open
not-so-fat wants to merge 1 commit into
chizhangucb:mainfrom
not-so-fat:fix/cursor-import-performance
Open

fix(cursor): cache global DB snapshot and batch bubble lookups on import#19
not-so-fat wants to merge 1 commit into
chizhangucb:mainfrom
not-so-fat:fix/cursor-import-performance

Conversation

@not-so-fat

@not-so-fat not-so-fat commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Cursor composer bubbles live in a multi-GB global state.vscdb; import was copying it once per workspace and querying each bubble individually.
  • Cache the global snapshot per process (invalidate on mtime/size) and batch cursorDiskKV lookups with IN queries.
  • On a machine with a ~4GB global DB and 31 workspaces, full Cursor import drops from ~259s → ~7–13s with identical message counts.

Diagnosis

Phase Before After
Scan all sources ~1.1s unchanged
Import 31 Cursor workspaces ~259s ~7–13s
Warm-cache workspace import ~6s+ each 21–695ms

Root cause: parseCursorWorkspace() called openSnapshot() on the global DB for every workspace. With a large Cursor history that is mostly disk-copy overhead, plus thousands of per-bubble SQL round-trips.

Test plan

  • node test/make-cursor-fixture.mjs + parse fixture (2 sessions, 7 events)
  • Profiled real machine: 14,903 events before/after match
  • Local dev import wizard: performance confirmed good on reporter's machine
  • Sequential import of 4 Cursor projects via /api/import (wizard step 3 path): first 5.3s (global copy), then 826ms / 122ms / 29ms

Cursor composer sessions store bubble payloads in a multi-GB global state.vscdb.
Import was copying that file once per workspace and issuing per-bubble SQL queries,
making multi-project imports feel stuck on machines with large Cursor histories.

Co-authored-by: Cursor <cursoragent@cursor.com>
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