Skip to content

perf: reduce execution map copies in run history - #12253

Merged
mscolnick merged 1 commit into
trevor/mo-8406-read-the-runs-panel-from-the-hostfrom
kg/mo-8797-cut-run-map-copies
Dec 3, 2026
Merged

mscolnick merged 1 commit into
trevor/mo-8406-read-the-runs-panel-from-the-hostfrom
kg/mo-8797-cut-run-map-copies

Conversation

@kirangadhave

@kirangadhave kirangadhave commented Dec 3, 2026 •

Copy link
Copy Markdown
Member

This pull request was authored by a coding agent.

📝 Summary

Stacked on #12180. Capture each execution as it arrives and reuse its run’s private member map until the next display frame. The first write after publication copies the map so an earlier frame keeps its original entries.

A local replay sent 1,000 cells through queued, running, and completed states on both revisions. With one display frame per 32 messages, median time from transport-message handling through frame publication fell from 320 ms on #12180 to 243 ms on this branch. This branch was faster in all 12 paired replays. Both revisions published the same 94 frames, and earlier snapshots kept their original records.

The base constructed 3,000 history member maps and copied 2,499,500 entries. This branch constructed 94 and copied 77,841 entries. In a 500-cell control that published after every message, both versions copied the same number of entries. The replay used one subscriber and excluded browser rendering. History still scans the live executions on each update.

Part of MO-8797.

📋 Pre-Review Checklist

  • For large changes, or changes that affect the public API: this change was discussed or approved through an issue, on Discord, or the community discussions (Please provide a link if applicable).
  • Any AI generated code has been reviewed line-by-line by the human PR author, who stands by it.
  • Video or media evidence is provided for any visual changes.

✅ Merge Checklist

  • I have read the contributor guidelines.
  • Documentation has been updated where applicable, including docstrings for API changes.
  • Tests have been added for the changes made.

Keep recording executions between display frames. Reuse private member maps until a frame takes a snapshot, then copy on the next write so earlier frames keep their records.
@kirangadhave
kirangadhave requested review from manzt and a balanced review from Copilot December 3, 2026 01:12
@kirangadhave
kirangadhave marked this pull request as ready for review December 3, 2026 01:12
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 78f3654.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The frame test does not catch allocation regressions because it also passes with the old copy-per-event implementation; deterministic identity or allocation-count coverage is needed.

1 open issue
What changed in this PR

Reduces execution-map copying in the host-protocol run history while preserving stable display snapshots.

Changes:

  • Reuses unpublished member maps and copies them on the first write after publication.
  • Captures history snapshots when display frames publish.
  • Adds a test for snapshot stability across frames.
File Description
frontend/​src/​core/​notebook/​replica/​run-history.ts Reuses draft maps until snapshot publication.
frontend/​src/​core/​notebook/​replica/​frame.ts Snapshots history during frame publication.
frontend/​src/​core/​notebook/​replica/​__tests__/​frame.test.ts Tests that published execution maps remain stable.

Review effort: Balanced

continue;
}
let members = copied.get(runId);
let members = run && drafts.get(run.executions);
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Coverage Report for ./frontend

Status Category Percentage Covered / Total
🔵 Lines 68.88% 28468 / 41329
🔵 Statements 68.83% 29017 / 42157
🔵 Functions 63.93% 6798 / 10632
🔵 Branches 64.28% 16670 / 25931
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
frontend/src/core/notebook/replica/frame.ts 100% 100% 100% 100%
frontend/src/core/notebook/replica/run-history.ts 100% 92.98% 100% 100%
Generated in workflow #26511 for commit 78f3654 by the Vitest Coverage Report Action

@mscolnick
mscolnick merged commit 40510ee into trevor/mo-8406-read-the-runs-panel-from-the-host Dec 3, 2026
26 of 27 checks passed
@mscolnick
mscolnick deleted the kg/mo-8797-cut-run-map-copies branch December 3, 2026 04:56
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.

3 participants