Skip to content

chore(today): trace the standalone Today window's cold open - #3359

Open
lodyai[bot] wants to merge 2 commits into
mainfrom
daily-notes-instant-load
Open

lodyai[bot] wants to merge 2 commits into
mainfrom
daily-notes-instant-load

Conversation

@lodyai

@lodyai lodyai Bot commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

$## Summary

Every open of the desktop Today (每日笔记) window cold-boots a new renderer and is reported as slow. This PR only adds measurement; it changes no behavior.

  • lib/today/today-window-boot-timeline.ts records renderer phases (entry, i18n, route, runtime create, workspace scope ready, top page acquired, content painted, page synced). It is a no-op outside the Today window.
  • today-windows.ts adds main milestones (created, did-finish-load, ready-to-show, shown) and logs one [today-window] boot timeline JSON line per cold open.

Findings (OSS desktop via the E2E harness, Linux arm64 + Xvfb, Playwright tracing off)

Click to painted content: about 1.10 s on an empty workspace, 1.55 s with 300 sessions. The window shows a boot shell at about 0.18 s.

Phase (ms from click) 0 sessions 300 sessions
Process, preload, HTML 0–180 0–180
10.7 MB main bundle load and compile 180–480 180–475
Top-level await (loro wasm compile) 480–625 475–620
i18n, router, workspace guard 625–730 620–725
Workspace runtime create 730–830 725–820
Wait for docMetaScope.ready (full metadata scan) ~210 ~550
Open and paint today page 1040–1100 1370–1555

The metadata gate grows by about 1.1 ms per session, and the Today pages do not need it. Most of the remaining cost (process, bundle, routing) is unrelated to the storage engine, so it does not need to wait for the loro-repo-rs integration.

Candidate follow-ups, not in this PR: let the Today window skip the doc-meta gate; keep the window alive on close or prewarm it (that needs an owner decision against the default of no hidden renderer); slim the boot bundle or enable a V8 code cache.

Test plan

  • pnpm check: typecheck and quick checks pass. One components test (conversation-text-selection) failed under full-suite load and passes on its own; it is unrelated.
  • pnpm format
  • Ran a built desktop with 0, 80 and 300 seeded sessions and read the logged timelines (numbers above).
  • Measure on macOS with a real workspace.

Generated with Devin

Each open of the desktop Today window cold-boots a renderer, and users
report it as slow. Record its boot phases in the renderer and log them
from main as one JSON line per open, so the dominant cost can be measured
on real workspaces before choosing a fix.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Model: claude-opus-5.5

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant