Skip to content

Register keyed row batches once in native containers - #2114

Merged
trissim merged 1 commit into
mainfrom
perf/sidebar-batch-registration
Nov 18, 2026
Merged

trissim merged 1 commit into
mainfrom
perf/sidebar-batch-registration

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

P265: one native registration per selected row batch

5 focused controls passed, exit 0. Equal-warm native container timing, five alternating pairs:

New rows Registration before → after Through following refresh before → after
80 54.50 → 23.16 ms 158.59 → 39.03 ms
320 285.83 → 131.10 ms 720.16 → 201.68 ms

Fixes #2113.

Delete repeated native registration

KeyedRows.reconcile_keys already selects a cohort through should_mount. It now collects its unattached new rows and calls one family hook, mount_rows. Textual uses mount_all, Qt uses addChildren. The old single-row hook is removed, with no compatibility path.

Each old Textual mount captured the growing displayed sibling list and scheduled another order-style pass. One native mount now owns that work for the selected cohort. Every existing consumer inherits this shared reconciliation: sidebar groups, disclosures, channel activity, team tables/groups/pages and Qt tree rows. Already-attached transferred rows are not remounted. Duplicate input keys do not acquire an extra paint merely because registration happens after construction.

Row construction still observes the existing sidebar budget and hidden-state rule. Native registration finishes the selected creation cohort; this is not a hard frame-time bound or a claim that all idle/animation CPU is fixed.

Preserve native row state

The Textual control checks one native mount for 40 rows, one for the two later additions, exact order after reversing retained rows, object identity, retirement, changed-only painting, and zero mounting/painting for an unchanged reconciliation. Existing short-list, 400-row stepped-frame and hidden-sidebar/resume controls pass.

The Qt native control exposed selection loss in the existing take/reinsert reorder: expansion was restored but selection was not. The same owner now restores both native properties. Its control exercises batch addition, reorder, retained item identity, expanded/selected state, exactly-once retirement and a no-op.

The old standalone ThemedApp row fixture had become abstract after application capabilities moved. These controls now use the real Workspace.app/ToadApp fixture, not fake settings/error implementations.

Evidence and remaining reds

  • Focused command: PYTHONPATH=src /home/ts/code/projects/agent-comms/.venv/bin/python -m pytest tests/textual/test_sidebar_rows_in_steps.py tests/textual/test_channel_member_mount_lifetime.py tests/model/test_qt_keyed_rows.py -q -p no:xdist -o faulthandler_timeout=60 — 5 passed in 43.67 s, exit 0.
  • Broader sidebar run: 9 passed, 2 failed. The two retirement controls query whole inactive panels under the older simultaneous-panel layout. Both fail identically with the original reconciliation restored from base 7752071028541da509083a375423e60c24a3c3c1. They remain open; this PR does not claim them green or change panel navigation.
  • An initial runner attempt failed in helper descriptor relocation under the tool shell's 1024 descriptor limit. The bounded app run used 16384. That failed log is retained separately.
  • NRA authored plans applied the production and fixture changes; parsing passed. Empty architecture/preflight lists are not behavior proofs.
  • Equal warmups and alternating order were used for each timing cohort, with original base algorithms loaded from Git and identical native row order asserted. These are registration/refresh phase timings, not total Toad CPU savings.
  • Artifacts: /home/ts/.cache/agent-scratch/codex-latency/current-render/ (batch-targeted.log, batch-checks-fds.log, batch-retirement-baseline.log, batch-clock.py, batch-clock.json, NRA plans/results).
  • git diff --check passes. Rebase onto current main changed none of the five touched files.

Assumed: existing row factories do not require an earlier fresh row to be registered while constructing a later row; all current factory paths were traced. Existing attached-row transfers and native lifecycle callbacks remain the owners of their state. No user input was replayed or settings changed. Installation and installed native delivery are reported separately.

@trissim
trissim marked this pull request as ready for review November 18, 2026 08:30
@trissim
trissim merged commit 3c96183 into main Nov 18, 2026
1 of 2 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.

Register keyed row cohorts through one native bulk mount

1 participant