Skip to content

perf(home): bound per-row history and transcript work, lazy title citations, hidden clocks stay idle - #23436

Merged
Git-on-my-level merged 6 commits into
mainfrom
perf/mobile-home-row-work
Oct 24, 2026
Merged

Git-on-my-level merged 6 commits into
mainfrom
perf/mobile-home-row-work

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

perf(home): bound per-row history and transcript work, lazy title citations, hidden clocks stay idle

What changed and why

Part of the October 2026 lag hill-climb for David's report that the iOS app "still lags quite a lot sometimes when I'm scrolling or clicking on things". Home is the surface he uses most. Its rows did work proportional to his whole history or a whole transcript on every notify, and two timer-driven clocks rebuilt while hidden.

  1. Each mounted row searched the whole conversation history twice on every notify (conversation_list_item.dart:346), even when nothing had changed. The rows now read only what they show.
  2. Discarded and deferred row previews joined the entire transcript to show 160 characters (conversation_list_item.dart:54). They now read only the segments needed for the preview, and the text is identical.
  3. Title repair built and sorted a collection of every transcript ID for every title (note_citations.dart, called from conversation_title.dart). It now materializes IDs lazily, only when citation candidates need them. Behavior for arbitrary IDs is preserved (60 citation-contract cases, idempotency, 1,000 generated parity cases).
  4. The compact capture card rebuilt every second while showing no clock (processing_capture.dart:68).
  5. The live-episode clock rebuilt every second on hidden tabs (live_episode_clock.dart:39). It is now gated on TickerMode and still refreshes immediately when Home is revealed.

There is no visual change.

Before and after (deterministic counts)

Measurement Before After
8 rows, 2,000 conversations, 20 no-op notifies: history reads 639,200 0
Deferred-row preview of a 2,000-segment transcript: segment reads 2,000 4
20 title repairs over 2,000 IDs: materialized IDs 40,000 0
Compact capture card, 5 s: builds (visible and hidden) 5 0
Live-episode clock, 5 ticks on a hidden tab: builds 5 0 (visible stays 5)

The counts match with semantics on and off. No device frame-time improvement is claimed: host timing is noise-dominated. Device timing comes from the lag capture in #23413.

Checked, not a cause: the main list already uses lazy slivers with stable keys; the daily recaps carousel builds lazily with bounded static map images, not live map platform views; hidden tabs already stop their tickers; no-op row-content rebuilds were already zero.

Not changed here:

  • conversations_page.dart:87,141–143 still hashes entire lists (_identitySignature): 40,000 element reads across 20 snapshots of 2,000 items. That file is being edited in fix(episodes): synced fragments join the live episode and fold under its Home row #23418, so the fix waits for it. The fix: provider-maintained revision counters in ConversationProvider and LocalRecordingsProvider.
  • Transcript duration (conversation.dart:697) is still a full scan per call. Caching it safely needs invalidation where the capture controller mutates an aliased segment list, so it was left alone.
  • Title repair still traverses every ID for an ordinary title; this change removes only the materialization and sorting.

How it was verified

  • test/perf/home_row_work_perf_test.dart, home_capture_tick_perf_test.dart, home_title_materialization_perf_test.dart and home_remaining_work_perf_test.dart fail against the pre-fix code with the before column above, and pass now.
  • On the lane head, the Home suites pass: 169 tests, 2 existing feature-gated skips.
  • On the head merged with current main, the Home perf guards plus all of test/widgets/, test/pages/conversations/, test/pages/episodes/ and test/utils/ pass: 1,959 tests, 2 skipped by design.
  • flutter analyze is clean on all changed Dart files, and the INV-PERF-1 ratchet passes.

UI-Evidence: none -- no visual change; identical rows, previews, titles and clocks.

Product invariants affected

INV-PERF-1: Home rows, title repair and the hidden clocks now do O(visible content) work per notify or tick instead of O(history), O(transcript) or a rebuild while hidden.

Failure-Class: none

🤖 Generated with Claude Code

View guided diff Turn on auto-fix

Git-on-my-level and others added 6 commits October 23, 2026 20:21
Use the mounted row model for merge selectors and collect only the visible transcript prefix for discarded and deferred snippets. Guard deterministic history and segment reads with semantics enabled and disabled.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Only refresh capture cards that display elapsed time, and respect the tab TickerMode for timer-driven UI work. Guard compact-card rebuild counts and visible batch/call clock catch-up after hidden tabs.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Add hermetic handoff probes for title/duration transcript traversals and hidden LiveEpisodeClock rebuilds. These shared files belong to other surface lanes; probes report work without claiming a fix.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Preserve arbitrary IDs and repair passes while keeping the full transcript ID set lazy until exact citation membership is needed.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Subscribe to TickerMode before the first timer tick, catch up immediately when shown, and preserve visible clock updates. Guard both semantics modes and document the remaining duration-mutation and page-hashing work. Remove a redundant title import found by changed-file analysis.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-23T17:53:51.061625Z f5d4361 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@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: f5d4361ef9

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +348 to +349
isEligible:
!widget.conversation.isLocked && !provider.mergingConversationIds.contains(widget.conversation.id),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve the provider-membership check for merge eligibility

When an active server search returns an older conversation that is not in provider.conversations, this now marks the row eligible whenever it is unlocked, whereas isConversationEligibleForMerge deliberately returned false when the ID was absent. If selection mode was started from another result, tapping this search-only row adds its ID to selectedConversationIds; the selection bar counts it, but selectedConversations filters only provider.conversations, so merge confirmation and the bulk move/delete actions receive fewer conversations than the UI reports. Keep the membership check while avoiding a full history scan, for example via provider-maintained ID lookup state.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit f8617b0 into main Oct 24, 2026
50 checks passed
@Git-on-my-level
Git-on-my-level deleted the perf/mobile-home-row-work branch October 24, 2026 10:50
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