Skip to content

Reduce repeated work across startup, tray, Settings, logging, and history - #83

Merged
MyButtermilk merged 17 commits into
mainfrom
ccr-3d13e093-hy26cz
Oct 6, 2026
Merged

MyButtermilk merged 17 commits into
mainfrom
ccr-3d13e093-hy26cz

Conversation

@MyButtermilk

@MyButtermilk MyButtermilk commented Oct 5, 2026 •

Copy link
Copy Markdown
Owner

Large transcript histories, long Meetings, file stitching, and summary navigation repeatedly rebuild virtualizer keys, parse unchanged summaries, construct formatters, scan playback segments, and read or normalize database payloads. This change removes that repeated work across Live Mic, YouTube, file transcription, transcript details, and Meetings, lets independent startup reads progress concurrently, bounds repeated CPU/layout work in file stitching and summary navigation, exposes saved Settings before slow device queries, skips repeated log-console rendering work, overlaps native backend access with UI loading, and removes redundant tray work.

  • Preserve the original live-segment merge optimization: linear scan plus binary-search insertion, with stable-sort fallback for unsorted input or comparator ties. Prefetch Meeting details on pointer/focus intent, reusing fresh and concurrent requests.

  • Index saved Meeting playback intervals once per transcript snapshot; preserve alignment priority, stable ties, and end-exclusive boundaries. Keep edit/undo callbacks and virtualizer keys stable, memoize repeated scans, and index Follow rows by ID. Skip playback indexing without saved audio.

  • Keep shared history key callbacks stable so scrolling does not regenerate keys for every loaded transcript.

  • Memoize unchanged Markdown and transcript summary documents; copying a completed summary no longer reparses it, while query-cache updates still render.

  • Reuse bounded Intl date/number formatter instances by locale and options. Preserve native behavior for unusual options and clear date formatters on window focus to refresh the OS time zone.

  • Warm settings, active Meeting state, and histories independently. History pages remain sequential and frame-yielded, pass cancellation signals, and stop scheduling after cancellation.

  • Upgrade the two existing app-owned SQLite history indexes to cover pagination tie-breakers and status counts, replacing legacy definitions once. Reuse normalized FTS summary text for punctuation-only searches, with a lazy fallback for missing or mismatched FTS rows.

  • Retire finished word prefixes while stitching long files, normalize alignment keys once, reuse immutable words when speaker rewriting is unnecessary, and retain only two score rows plus byte-sized traceback moves. Preserve exact words, timestamps, speaker evidence, and warnings against the previous algorithm.

  • Reuse summary heading elements and binary-search fresh positions during scrolling. Keep the original document-order scan for headings inside tables or snapshot grids, and preserve layout-change, replacement-summary, and explicit-navigation behavior.

  • Compare the actual FTS projection inside the parent write transaction and skip unchanged index rewrites on progress-only saves. Missing/stale rows, summary-format changes, terminal transitions, and rollback behavior retain coverage.

  • Suppress unchanged upload patches and preserve snapshot identity. Partition File history only when its data changes, so upload/copy feedback does not rebuild all loaded rows.

  • Show Settings as soon as persisted values arrive; microphones and native autostart update independently. Preserve idle/page request sharing and cache expiry; detach stale in-flight work on invalidation and prevent old requests from repopulating the cache. Ignore late peripheral errors after unmount.

  • Retain log-console key callbacks and level counts for unchanged snapshots. Memoize log messages with stable copy callbacks and row-local copy feedback; serialize and mount redacted raw JSON only on opening its disclosure.

  • Start the bounded initial native backend-access lookup alongside locale/module loading, reuse it at mount, and start the background backend supervisor before hidden-overlay construction and autostart reconciliation. Preserve single-instance exclusion, locale-before-render, and fresh health/restart access checks.

  • Subscribe once to tray status before its initial read, reject stale snapshots, and bound stalled listener setup. Skip unchanged native visuals/events and duplicate tray delivery; refresh hotkey labels on opening instead of every status event. Reuse an opening's pending history read on entering Recent Transcripts, preserving fresh reopening reads and authoritative copy-by-ID.

  • Apply the supplied review: publish idle Settings independently of microphone discovery and reject stale publication after invalidation or any newer query state; report microphone failure separately and suppress duplicate errors. Recover initial tray shortcut/history reads if opened-listener setup fails or stalls.

  • Require 150 ms of Meeting-row pointer/focus intent, permit one speculative detail request, and cancel abandoned owned reads while preserving navigation, existing consumers and fresh cache reuse. Fuse review filters into one traversal, build membership sets only for active filters, and reuse filtered rows for timeline markers while retaining unfiltered match navigation.

  • Keep live Meeting display objects stable across immutable segment updates and memoize each transcript row. Draft/saving state affects only its row; playback callbacks no longer change with unrelated detail updates. Speaker, locale, text, timing and revision changes still update correctly.

  • Isolate frequently typed Settings text in field-local subscriptions; keep debounce, blur saves, locale defaults, resets and model canonicalization intact. Move Live Mic streaming/clock updates behind a memo boundary so they do not reconcile history. Subscribe to Meeting notes only in the editor, and keep Meeting chat typing local while preserving draft ownership and send/reset behavior.

  • Keep the Visualizer-bars drag draft local; serialize commits, protect newer drafts from older failures, and persist a revert behind an outstanding save. Memoize the shared virtual history and stabilize row-render/next-page callbacks across Live Mic, YouTube and File. Preserve action feedback, new results, layout changes, scrolling and resizing.

Measurements and regression gates

Local synthetic workloads; medians on Linux with Node 26.5.0 and Python 3.14.7 / SQLite 3.53.1. Benchmarks validate output equivalence before reporting timing.

Workload Before After
2,000 Meeting playback lookups, 12,000 overlapping segments 55.299 ms 1.828 ms
Transcript renders across 20 playback ticks within one segment 20 0
History row-key calls when scrolling 10,000 loaded items 10,054 <100
Additional Markdown parses when copying a 200-section summary 1 0
Date + number formatting for 5,000 rows 524.065 ms 29.587 ms
History page + count for 5,000 equal-timestamp records 11.448 ms 0.781 ms
Literal punctuation search across 5,000 HTML summaries 926.368 ms 37.186 ms
Timed file stitching, 160 parts / 17,276 input words 400.459 ms 127.233 ms
Traced Python peak allocations, 300 × 300 alignment cells 1,544,768 bytes 154,318 bytes
Heading geometry reads per scroll, 512-section summary 512 ≤10
25 progress saves, one synthetic 20,000-word transcript 432.504 ms 48.884 ms
Upload percentage notifications, 10,000 progress events 10,000 100
History status reads during copy feedback, 10,000 loaded files 20,003 <10
Log virtualizer key calls, unchanged refresh with 1,200 records 2,412 <100
Instrumented context-field reads across 20 unchanged message renders 60 0
Closed raw log JSON serializations on initial render 1 0
Tray hotkey queries across 100 status events 100 0
History reads when entering Recent Transcripts during opening fetch 2 1
Meeting detail reads when crossing ten rows without dwelling 10 0
Meeting display projection, 100 updates × 12,000 segments 62.069 ms 23.935 ms
New display objects for those 100 updates 1,200,000 100
Row renders for 20 correction keystrokes, three visible rows 60 20
Existing row renders for an offscreen live append, three visible rows 3 0

Playback index construction takes 1.876 ms per changed snapshot. The original live merge benchmark reported about 2.3x less wall time for 6,000 segments and 9.06M → 4.56M comparator field reads for 3,000 events.

Deterministic regression gates cover timestamp reads, React renders, virtualizer key calls, formatter construction, HTML projection calls, and SQLite execution work. History paging drops from approximately 229,100 to 55,000 SQLite VM steps, with a 60,000-step test ceiling. Punctuation search executes more SQL VM steps for the join but eliminates repeated Python HTML parsing; its gate checks zero projection calls for intact FTS rows. Long-file merging additionally stays below 600,000 timestamp reads (reference: 4,144,904), normalizes each alignment word once, and keeps the dense alignment fixture below 400,000 traced bytes. Randomized reference comparisons cover 160 adversarial overlap cases. Alignment still has quadratic cell count; no evidence is truncated. Progress-save tests require one parent-row change per save and no FTS shadow-table changes. Upload tests preserve the separate server-processing transition after early rounded 100%; File history tests also verify completed records change groups. Wall-clock timings remain informational. The scrolling, summary-copy, startup-waterfall, and playback-render tests were also checked against their previous implementations.

Reproduce with npm run benchmark:meeting-display, npm run benchmark:meeting-review, npm run benchmark:formatters, python scripts/diagnostics/benchmark_history_reads.py, python scripts/diagnostics/benchmark_transcription_merge.py, and python scripts/diagnostics/benchmark_transcript_writes.py. The database benchmarks use isolated temporary databases. The FTS guard adds an indexed comparison when content really changes: a supplemental alternating check with fresh, identically seeded databases measured 443.10 → 458.26 ms for 25 changed-content saves (five-run medians, about 3.4% overhead). The approximately 8.8x write speedup applies to progress-only saves, not every write.

Further Opus performance pass

Claude Code 2.1.291, Claude Opus 5.5 with --effort max, implemented and tested the further typing/streaming changes; Codex reviewed and integrated them. This follows the blog's approach of profiling interactions and removing repeated work. The local production Chromium comparison used five runs of 60 synthetic events against 79b812a; values below are medians of run medians for event processing, not displayed-pixel or installed Windows latency.

Interaction Before After
Settings vocabulary keystroke 21.7 ms 0.7 ms
Live Mic interim transcript event 2.1 ms 0.7 ms
Meeting note keystroke 3.2 ms 0.8 ms

Exact component-test spies additionally bound unrelated work: Settings tooltips 528 → 0 across 24 vocabulary keystrokes, history-toolbar renders 22 → 0 during streaming, notes-owner renders 24 → 0 while typing, and Meeting question translation-hook calls 114 → 19. New budget tests were checked against the prior implementations. The browser benchmark reports committed fiber identity changes separately; these approximate rendering work and are not exact render or DOM-mutation counts. Reproduce with scripts/diagnostics/benchmark_frontend_interactions.py; detailed methodology and remaining candidates are in docs/PERFORMANCE_AND_PACKAGING.md.

Further slider and history pass

Exact tests against 5789414 show 440 → 0 Settings-wide tooltip renders for 20 slider movements, 140 → 0 visible-row render-function calls for 20 unrelated parent inputs with 10,000 loaded records, and 20 → 0 virtualizer hook calls for 20 searches on the real Live Mic page. All three budget tests fail on the preceding implementation. New slider tests cover commit-only persistence, rollback, newer drafts and a return to the saved value behind a pending write.

Production Chromium history-search timing (three runs × 60 synthetic events) changes only modestly: 2.75 → 2.50 ms/event, CDP script CPU 2.962 → 2.906 ms/event. These timings do not establish a broad latency win; deterministic work counts are the regression gates. Separate host-fiber identity changes fall approximately 124 → 70/event, which is not a DOM-mutation count. The checked-in browser diagnostic now supports Live Mic, File and YouTube history-search scenarios.

Validation

  • Current head d665029: all nine CI jobs passed, including 5,639 Python tests passed, 18 skipped, Windows Rust checks/tests, frontend gates, real-browser integration and the release quality barrier. Local final checks pass: TypeScript, ESLint, 142 library + 252 component tests (component suite with one worker), production build, changed-file Prettier and CI-pinned Ruff. 102 frontend/Meeting source gates passed, 2 platform-dependent skips; assertions still verify the extracted slider awaits the authenticated Settings writer.

  • Current-pass production Chromium checks: 19 history-route interactions passed across Live Mic, YouTube and File, with no console errors, page errors or unhandled rejections. A separate native-pointer probe moved the actual Settings slider from 45 to 94: zero writes during dragging, exactly one after release. The broader local run timed out at the unchanged Settings Outlook synced-event check without browser errors; the scoped history and slider checks passed independently. No product changes or increased time limits were used to bypass that timeout. These checks use the synthetic backend, not installed Windows/WebView2.

  • Previous head 5789414: all nine CI jobs passed, including 5,639 Python tests passed, 18 skipped, Windows Rust checks/tests, frontend gates and real-browser integration. Local final checks pass: npm run check, npm run lint, all 142 library + 246 component tests, production build, changed-file Prettier, and CI-pinned Ruff 0.15.22 for the new diagnostic. A small production-browser run verifies the diagnostic's Meeting-chat scenario and renamed fiber-counter output.

  • The first full Python CI run passed 5,637 tests and exposed two source-text assertions tied to the former Live Mic field order and chat setter. Updated only those gates to the new ownership boundaries, preserving stable date references and both draft resets; 102 source/Meeting gates pass, 2 platform-dependent skips locally. Product code is unchanged by this follow-up.

  • The previous Opus pass's functional Chromium smoke checks pass for Live Mic, Meetings and Settings. The initial route order contaminated the Meeting request log with earlier Settings actions; placing Meetings first resolves that check. One full-route fast-tab sample took 2,569.7 ms against a 2,000-ms limit; the paired baseline/candidate repeat passed at 1,669.4/1,473.0 ms without changing the budget. This does not establish the cause of the timing outlier.

  • Previous head 79b812a: all nine CI jobs passed, including the full Windows Python suite, Rust fmt/clippy/tests, frontend check/lint/tests/build, browser integration, typechecking, and release quality barrier.

  • Previous head 39bdf44: all nine CI jobs passed, including the complete Windows Python suite, Rust fmt/clippy/tests, frontend checks/tests/build, browser integration, typechecking, and the release quality barrier.

  • Node 26.5.0: npm run check, npm run lint, npm test (139 library + 235 component tests), npm run build, and changed-file Prettier checks passed locally.

  • Python: 43 database/search and summary HTML tests passed for the persistence changes; the merge pass validated 108 merge/provider tests. Ruff check and formatting passed for changed Python files. The full provider integration suite runs in CI; the local lightweight environment lacks Pipecat.

  • Real Chromium smoke passed for Live Mic, YouTube, file transcription, and transcript details, including rapid primary-tab switching, locale/theme changes, transcript actions/cancellation, command palette, desktop/mobile layouts, and token enforcement.

  • Removed the observed CI timeout from the summary-scroll test by locating asserted links by navigation target, keeping all 512 headings, the ten-read ceiling, and the original timeout.

  • Targeted real Chromium Settings/Debug smoke also passed with rapid tab switching, Settings persistence, voice/Outlook actions, console filters/copy/clear/export, locale/theme, desktop/mobile and token checks. Refreshed the smoke fixture with required Outlook calendar fields and the current audio-cleanup control label; interaction timeouts now include captured browser errors. 26 browser-smoke script tests passed.

  • Settings/cache and log rendering add 11 component tests; the three log work-budget gates fail against the preceding implementation. Backend log regression tests: 65 passed, 2 Windows-specific skips locally. The 92 frontend source/type gates also pass after aligning two variable-name assertions with the Settings refactor, preserving their identity-guard and shared-type requirements.

  • Startup and tray add 10 component tests covering prefetch, bounded fallback, pending-read sharing, listener failures, stale responses, and cleanup. The two tray work-budget fixtures fail against 52a3b22d (100 hotkey queries and two history reads). 148 frontend/shell source gates pass locally; two PowerShell-dependent gates run in Windows CI. Rust formatting passes with CI-pinned Rust 1.97.0; native compilation/tests run in Windows CI. Main/Settings Chromium smoke also passes. A real Chromium tray probe with simulated native IPC confirms zero hotkey queries for 100 status events, one pending history read, a fresh read and shortcut lookup on reopening, and copy_transcript:mic-1 dispatch with no browser errors; it does not exercise the native Windows clipboard. The startup timing fixture uses simulated 200-ms module / 120-ms access work and is not an installed cold-start measurement.

  • The first Windows full-suite attempt passed 5,634 tests but hit three timeouts in unchanged Meeting/Podcast tests. All three pass unchanged in targeted local runs; the repeated full Windows suite passes without code or timeout changes (5,637 passed, 18 skipped).

  • Review follow-up: 15 additional library/component tests cover preload/save races, equal-timestamp cache writes, tray listener fallback, accurate Settings errors, prefetch ownership and navigation, and 216 search-filter combinations. The old 94e7107 preload overwrites newer Settings in the new tests, and its row-crossing fixture starts ten requests; the fixes pass.

  • Real Chromium Meeting/Settings smoke passes, including Meeting editing and rapid tab switches. The first attempt missed the note-save request; the repeated run passed without product changes. Added browser-state diagnostics for that failure, and all 26 smoke-script tests pass.

  • The review follow-up CI exposed a pre-existing startup-recovery test race: a completed task had already left the running-task map. Three tests now capture the real registered task; two extra cases force completion before the startup scan returns, retaining every durable-state and no-replay assertion. All 22 job-resume tests pass locally.

  • Live Meeting rendering follow-up: the new real-page work-budget tests fail on 39bdf44 (60 row renders for 20 keystrokes and three unchanged rows rendered after an offscreen append) and pass after the change. Four projector tests cover immutable updates, reordered/removed rows, reused IDs, label changes and a 12,000-segment work ceiling. The initial synthetic projection rises from 0.787 to 2.245 ms; steady updates fall from 62.069 to 23.935 ms. 102 frontend/Meeting source gates passed, 2 skipped locally.

  • Real Chromium Meeting smoke passed, including edits, locale/theme changes, playback, fast tab switching, desktop/mobile layouts and token enforcement. The broader initial Meeting/Settings run timed out at the unchanged Outlook-disconnect confirmation without browser errors; the scoped Meeting run passed.

  • Review scope: cold-cache Windows database-index migration timing and live Meeting React commit profiling remain unmeasured. The hypothesized concurrent overlay creation is not established by current call paths: shell/hotkey creation dispatches to the UI thread. No migration or overlay lifecycle change was made from that hypothesis.

  • Updated performance, testing, and agent guidance. The browser locale-persistence probe now tolerates the transient missing document element during navigation while retaining its completion assertions. No dependency changes.

These are workload-specific CPU, database, and rendering improvements, not a whole-app speedup estimate. Chromium smoke uses a synthetic backend; installed Windows/WebView scrolling, native audio, provider latency, and large real-database migration time still require target-environment validation. The production build retains its existing large-chunk warning.

Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_018Nx3m5BTLHocoRSs6Ej4Km

…intent

Measure-first pass modeled on the claude.ai performance sprint:

- mergeMeetingSegment no longer copies and re-sorts the whole transcript per
  live websocket segment. One linear scan plus binary-search insertion keeps
  the exact replace/append-then-stable-sort result; unsorted input or
  comparator ties fall back to the full sort. 6,000-segment stream: ~2.3x
  less wall time, comparator field reads halved (9.06M -> 4.56M for 3,000
  events).
- Randomized equivalence test against the reference implementation plus a
  deterministic work-budget ceiling (ratchet) for a long live Meeting.
- Meeting library rows prefetch their detail on pointer enter/focus so the
  request overlaps the click instead of starting after navigation.

A WeakMap reuse of labeled display segments was measured slower than the
existing spread and is intentionally not included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018Nx3m5BTLHocoRSs6Ej4Km

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: df082bf471

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread Frontend/client/src/pages/Meetings.tsx Outdated
@MyButtermilk MyButtermilk changed the title Speed up live Meeting segment merges and prefetch Meeting details on intent Speed up Meeting segment merges, playback, and detail navigation Oct 5, 2026
@MyButtermilk MyButtermilk changed the title Speed up Meeting segment merges, playback, and detail navigation Reduce repeated UI and history work across Scriber Oct 5, 2026
@MyButtermilk MyButtermilk changed the title Reduce repeated UI and history work across Scriber Reduce repeated UI, Settings, logging, and history work across Scriber Oct 6, 2026
@MyButtermilk MyButtermilk changed the title Reduce repeated UI, Settings, logging, and history work across Scriber Reduce repeated work across startup, tray, Settings, logging, and history Oct 6, 2026
@MyButtermilk
MyButtermilk merged commit b34d537 into main Oct 6, 2026
19 checks passed
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