Skip to content

perf(editor): optimize caching, history and conversation rendering - #266

Merged
chaxus merged 4 commits into
mainfrom
perf/runtime_and_storage
Oct 14, 2026
Merged

chaxus merged 4 commits into
mainfrom
perf/runtime_and_storage

Conversation

@chaxus

@chaxus chaxus commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Merge Verdict

[APPROVE] — The original runtime/storage optimizations and three additional performance features are implemented and independently reviewed, with no unresolved blocking findings.

46 files · +3663 / -485 · offline caching, local history, conversations, assistant UI, model cache and quality gates

Summary

  • Reduce mandatory app precache from 54.8 MiB to 1.39 MiB through Vite's core/static UI versus optional inference dependency graphs. Preserve explicit/persisted opt-in and optional assets across worker updates, including legacy users and preparation races. Figures are build-file bytes, not network-transfer measurements; native vendor precache remains unchanged.
  • Bound latest snapshot reads and revision trimming, coalesce conversation saves and persist changed sessions atomically, and remove assistant context/sidebar/preview polling using disposable SDK/input/DOM/media notifications.
  • Add three independently committed performance features: linear action initialization and batched chat restoration, indexed history-expiry candidates, and exact-group GGUF batch deletion. Preserve interaction, retention and deletion semantics.
  • Repair jsdom fixtures, rebuild workspace declarations before type checks, tighten coverage gates and update package/project guidance.

Risk Analysis

Risk Level Mitigation
Stored-data upgrades and retention Medium Transactional legacy migrations remain covered. Indexed expiry keeps reopening renewal, inclusive cutoff, stable timestamp ties and cancellation rollback; byte/handle accounting tests pass.
Offline behavior across deploys Medium Retain native first-export precache and static UI dependencies. Prepared markers, legacy handoff, install/activation rechecks and controller-change preparation cover optional runtime updates.
Chat controls and scrolling Low Existing renderer and normal append behavior retained. Tests cover action outcomes, draft transitions, grouping, partial answers and reader scroll intent; Chromium restores 400 saved messages and switches sessions.
Model-cache deletion Low Delegate exact filenames to installed SDK deleteMany; real SDK tests verify body/metadata cleanup, unrelated models, missing groups and error propagation.

Design Decisions

  • Keep the small static assistant UI graph in mandatory core so old live pages retain lazy UI imports after deployment. Large inference assets remain optional; default-off visits do not prepare models or connect services.
  • History adds a compound revision/byte-length index in the original optimization. Latest retrieval stops after one value, trimming reads keys, and this follow-up uses the existing updatedAt index for expiry without another schema change.
  • Preserve complete conversation input validation and full-snapshot repository APIs. Identity-only serialization caching would miss callers that mutate loaded messages in place. Unchanged sessions skip IndexedDB writes.
  • Assistant UI notifications coalesce into one queued refresh. No recurring context/sidebar/preview timers remain; stale targets are still checked before applying. Autosave timing and bounded native initialization/font waits retain their behavior.
  • Chat history uses an additive appendMany API rather than virtualization. Streaming continues to append text per frame and parse Markdown on completion; original source metadata is finalized once at completion/interruption.
  • Follow the user's feature-per-commit request: retain the original reviewed commit and three separate new commits; do not squash this PR. No dependency/lock versions, vendor code, model defaults or external services change in this follow-up.

Follow-up commits and measured work reduction

Commit Feature Deterministic comparison
79034c66 Chat rendering and conversation restoration For 500 messages, action-state writes 125,250→500, scroll calls 500→1, scrollHeight reads 1,500→3. Twenty streaming frames write no full source attributes; completion publishes once.
60bad002 Indexed history expiry 2,005 metadata rows become 5 candidates. Normal snapshot writes retain one budget scan instead of two full metadata scans.
c891d820 GGUF group deletion Eight-shard adapter/SDK probe: 9→2 inventory scans, identical deleted/remaining filenames. Regression tests exercise actual installed SDK methods.

These are operation counts on deterministic fixtures and local SDK/storage probes, not claimed browser latency, heap or transfer improvements. Details: docs/explorations/2026-10-13-follow-up-performance.md.

Code Concerns

No unresolved findings from independent reviews. Offline-update races and missing spreadsheet content/sheet notifications were fixed and rechecked. The follow-up review traced real callers, installed SDK deletion semantics, expiry ordering and chat action/stream ownership without finding additional correctness issues.

Verification

Check Result
Final full unit coverage, repository-pinned toolchain 5394 passed, 181 files; lines 85.75%, branches 80.12%; all tightened gates pass.
Final follow-up Chromium E2E, repository-pinned toolchain 38 passed: 400-message restoration and session switching, context notifications, assistant entry/native writes, history search/pagination/expiry/export, autosave recovery.
Earlier offline/storage Chromium E2E, pinned toolchain 35 passed, including the separately run silent SW update case.
Earlier optimization revision, pending upgraded toolchain 5360 unit tests passed, coverage gates and 34 affected E2E cases passed. The isolated SW update case times out on both branch and unmodified main with Playwright 1.64; pinned Playwright 1.62.1 passes on both. These dependency upgrades remain outside the PR; the newest follow-up was tested with pinned dependencies.
Lint, workspace declaration rebuild and TypeScript Passed, including package and application declarations.
Formatting and diff whitespace Passed.
Production build Passed; current mandatory app precache is 1,456,339 bytes / 1.39 MiB.
Docker Compose configuration Passed.
Independent code review All new feature scopes approved; no unresolved Critical/Important findings.
Git boundaries Clean worktree; current origin/main is the base; original commit plus three separate feature commits.

Conclusion basis

  • Verified: production builds and manifests, full unit/coverage suites, actual installed SDK/cache behavior, deterministic operation counts and affected real-editor Chromium flows.
  • Observed locally: unthrottled editor reload trace reports CLS 0.06; no LCP or field data was returned. This is not a cold production benchmark and prompted no vendor rewrite.
  • Not covered locally: the entire multi-host/browser CI matrix, real-user timing or production deployment. No merge or deployment was performed.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Deploying document with  Cloudflare Pages  Cloudflare Pages

Latest commit: c891d82
Status: ✅  Deploy successful!
Preview URL: https://760c47e8.document-7hm.pages.dev
Branch Preview URL: https://perf-runtime-and-storage.document-7hm.pages.dev

View logs

@chaxus
chaxus force-pushed the perf/runtime_and_storage branch from 1e090f8 to 0131b52 Compare October 13, 2026 15:34
@chaxus chaxus changed the title perf(editor): reduce offline startup and storage overhead perf(editor): optimize caching, history and conversation rendering Oct 13, 2026
@chaxus
chaxus merged commit 6b4ec74 into main Oct 14, 2026
20 checks passed
@chaxus
chaxus deleted the perf/runtime_and_storage branch October 14, 2026 01:52
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