Skip to content

Make large-document interactions responsive - #31

Open
carlassmann wants to merge 28 commits into
mainfrom
codex/performance-improvements
Open

Make large-document interactions responsive#31
carlassmann wants to merge 28 commits into
mainfrom
codex/performance-improvements

Conversation

@carlassmann

@carlassmann carlassmann commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Why

Opening and saving book-sized documents could freeze Alkalye for seconds. This PR makes core interactions faster without splitting a document's CoPlainText.

Approach

  • Paint the document before loading comments, assets, cursors, and other secondary Jazz data.
  • Calculate save diffs and three-way merges in a worker. The UI's Jazz node remains the writer.
  • Acknowledge saves after local Jazz storage, without waiting for network sync.
  • Rebase queued local edits over concurrent collaborator changes instead of overwriting either side.
  • Use Jazz entry indexes for Unicode-safe patches.
  • Keep valid loader data visible until deferred Jazz subscriptions start. Document switches no longer flash not-found.
  • Keep /new preloads side-effect-free. Hovering New no longer creates a document.
  • Load legacy metadata sequentially after first paint; stale read-only documents remain visible while filtering.
  • Reduce editor-decoration, sidebar-rendering, and filtering work.
  • Disable rich Markdown decorations and spellcheck above 128 KiB. Plain editing remains available.

Measurements

1 MiB document, 4× CPU throttling:

Interaction Before After
Open document input delay 376 ms 160 ms
Open sidebar input delay 256 ms 232 ms
Filter input delay 72 ms 64 ms
Switch space input delay 48 ms 48 ms
Seed two documents 58.9 s 33.3 s

Latest controlled 128 KiB / 4× CPU run passed all budgets. Input delay was 83.2 ms while typing, 2.7 ms for autosave, 19.3 ms opening the sidebar, 3.3 ms opening a document, and 9.5 ms switching spaces.

Completion latency remains slower than one frame: 1.89 s opening a document and 1.65 s switching spaces. This PR establishes benchmarks for continued work rather than claiming the 60 Hz goal is finished.

Verification

  • bun run check: 813 tests plus lint, types, and formatting pass.
  • Large-document E2E waits for local-storage acknowledgement, reloads immediately, and verifies the full 128 KiB content through the clipboard.
  • Two-browser collaboration E2E verifies simultaneous writers converge without rolling back local text.
  • Save unit tests cover worker failure, queueing, Unicode patching, concurrent edits, and main-thread fallback.
  • Navigation E2E covers New-button hover and document-switch not-found flashes.
  • Responsiveness benchmark covers typing, autosave, undo/redo, command palette, find, tools, sidebar, filtering, document opening, and space switching.

Scope

Documents remain one CoPlainText. This PR does not redesign the UI. Large documents show a notice when rich editor features are disabled.

@vercel

vercel Bot commented Sep 4, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
alkalye Ready Ready Preview Sep 5, 2026 2:56pm UTC

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