Skip to content

Fix composer jank when a large minified-JS blob is pasted - #1

Open
jjcm wants to merge 16 commits into
mainfrom
cursor/composer-large-paste-perf-1f84
Open

jjcm wants to merge 16 commits into
mainfrom
cursor/composer-large-paste-perf-1f84

Conversation

@jjcm

@jjcm jjcm commented Aug 17, 2026 •

Copy link
Copy Markdown
Owner

Final Sol-filtered performance stack: composer paste + Track A load time

The overnight loop is complete. KEEP_DITCH.md is now the authoritative Sol record: every landed product change has an explicit verdict, measured value, complexity/maintenance rationale, tradeoff, and VM-vs-Electron label.

Final filter

Composer paste — all product keepers stay

  • KEEP: near-linear Markdown parser rewrite. Final 1 MB synthetic minified-JS run: 2,059 → 10.05 ms (Linux Node/Vitest; not Electron).
  • KEEP: structural controlled-value compare, bounded trigger scan (~0 ms at 1 MB), large-doc mapped/deferred decorations (built-in regex 8.10 ms deferred), persist-boundary draft serialization (2.48 ms/edit removed), non-subscribing ThreadDetailView draft accessor.
  • KEEP: deterministic fixture + gated primitive-level microbenchmark.

No paste keeper showed a correctness regression. The explicit tradeoffs remain: ≤200 ms decoration lag over 100k positions and 254-character windowed typeahead query cap.

Load Track A — all three measured product keepers stay

  1. KEEP: pierre/Shiki/KaTeX removed from the workspace route's static closure via lazy diff/file-code islands and content-gated math.
  2. KEEP: plugin-frontend boot deferred until idle; plugin panel deep links boot immediately.
  3. KEEP: ThreadDetailView lazy per pane; root compose stays static (the measured three-way split was a wash and remains reverted).

KEEP-WITH-TWEAK applied: lazy KaTeX now catches chunk-load rejection, keeps readable TeX fallback, avoids an unhandled promise, and permits a later retry.

KEEP: bundle/load harnesses and optional gitignored full chunk graph. The bundle budget now documents its ratchet reason, and its checker counts intentionally uncompressed sub-1KB chunks at their actual raw wire size instead of failing a valid precompressed build.

DITCH / absent spike work

  • Removed measure-chunk-eval.mjs: one-off hashed-chunk spike code, not a durable harness.
  • No zod product change landed; the miss remains documented.
  • No full three-way pane split landed; it was measured and reverted earlier.

Final measurements on filtered HEAD

Load environment: Linux headless Chromium over localhost, production build, seeded 400-thread/120k-event DB, cold cache, 4× CPU throttle, medians of 7 — not Electron.

Route FCP LCP Route-ready
/ 844 ms 1,148 ms 1,721 ms
canonical project/thread 868 ms 2,176 ms 2,159 ms
/settings 792 ms 1,040 ms 1,035 ms

Important precision: / route-ready means the [data-promptbox-editor-content] wrapper is present. TipTap creates/attaches ProseMirror in a post-mount effect, so this is not claimed as editable-ready or TTI. Electron FCP/LCP/TTI and macOS cold start remain unmeasured; strago steps are preserved in KEEP_DITCH.md.

Cumulative Linux Chromium result: / wrapper-ready 2,494 → 1,721 ms (−31%), FCP 920 → 844 ms, LCP 1,236 → 1,148 ms. Final boot budget: 1,669.1 KB raw / 449.7 KB adjusted brotli versus 1,672.0 / 450.0 KB limits; cumulative cost +12.4 KB brotli fragmentation (+2.8%) against ~2.25 MB raw removed from the default route parse/execute path.

Verification

  • Full @bb/app suite: 349 files, 2,778 passed / 3 skipped.
  • Typecheck: passed.
  • Lint: passed, zero errors (145 existing warnings).
  • Bundle budget: passed; forbidden lazy-only packages absent.
  • Paste and load harnesses: passed on final filtered HEAD.
  • This fork reports no configured PR checks.

The PR remains open. No merge or force-push was performed.

AGENT GENERATED: by GPT-5.6 Sol

Open in Web Open in Cursor 

@jjcm
jjcm marked this pull request as ready for review August 17, 2026 06:18
cursoragent and others added 12 commits August 17, 2026 06:28
cursor Bot pushed a commit that referenced this pull request Aug 18, 2026
Side-by-side recording of the first thread open on the production build:
lazy thread pane (as proposed in #1) versus the static import kept by this
branch. Real timescale slowed 8x; the counter freezes at each side's painted
time (399 ms lazy, 126 ms static on the recording machine).

Co-authored-by: Jacob Miller <[email protected]>
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.

2 participants