Repository navigation
perf(timeline): stop cloning settled turn rows on every streaming update - #2431
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Streaming into a long assistant turn no longer clones thousands of settled rows or re-scans the whole turn prefix on every structural update.
Previously, each tool transition or new block in a long turn copied every cached rowspec across all frozen 64-step prefix chunks just to stamp the turn's latest
endindex andliveflag, then re-spaced the entire turn. Rendered rows, vertical rhythm, disclosures, pagination, and multi-server cache isolation stay identical.❌ Before
RowSpecs out of them to overwriteendandlive, and re-runs divider and rhythm spacing across the whole vector.✅ After
Rc<[RowSpec]>slices pre-spaced once on creation and shared directly withProjection; mounted rows read current(end, live)from a compact sorted per-turn table onProjection, and unchanged chunk-pair seams reuse their prior seam overrides.📊 Numbers: 1,506-session synthetic multi-stream workload (2,098-message root transcript with a 1,200-step active turn, 11 concurrent streams, 1 warmup + 7 measured headless runs, 476 steady frames/run on Apple Silicon)
dev)cloned_rows_p95projected_msgs_p95update_p50_msupdate_p95_msview_cpu_mean_mscommit_cpu_mean_msinput_encode_p50_msalloc_mb_p50 / p95REGION_WARNINGS👀 Read:
crates/session-view/src/timeline/turn_cache.rs(prefix's strictc.end < frombound so the fast-forwarded cursor message itself is guaranteed unchanged) andcrates/session-view/src/timeline/projection.rs(space_seamsreusing seam overrides acrossRc::ptr_eqchunk pairs andsame_keysskippingRc::ptr_eqchunks inO(1)). The rest is routine.🔍 Follow-up to #2400–#2404 streaming frame-cost pass · no user reports · measured across 1 warmup + 7 headless runs (476 steady frames/run) on Apple Silicon
Checks run
bash scripts/guardrails.sh: 11/11 passedcargo check --bin opencode-desktop: passcargo check -p session-view --examples: pass--features frame-profile, 1 warmup + 7 runs + debugdev-fastregion-reuse check): pass, 0 region warnings