Repository navigation
perf(timeline): wire virtual_row_heights_version and zero-alloc row_height::shape (Wave 7c) - #2557
Merged
Merged
Conversation
…eight::shape (Wave 7c)
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.
Wires
rune#3977's additiveEl::virtual_row_heights_version(...)(pinned in#2550at9e0b8f494) ontocrates/session-view/src/timeline/mod.rssoVirtualList::sync_known_heights_checkedskips scanning0..specs.len()on steady-state commits (composer typing,plugin:perfticks, unchanged warm tab returns), and removes per-row heap allocations insiderow_height::shapewhen real scans run.flowchart LR A["App::view() commit"] --> B{"timeline-fade reused?"} B -- "Yes (typing / perf tick)" --> C["sync_known_heights_checked<br/>cached version + env + stamp.reads"] C -- "All match" --> D["0 row scans"] C -- "Tracked read changed<br/>(expanded / line_hold / MATH_GEN / ...)" --> E["Full scan (zero-alloc shape)"] B -- "No (tab switch / transcript / resize)" --> F["row_height::heights_version(...)<br/>(Paused tracked reads)"] F --> G{"version == stamp.version<br/>&& env && reads match?"} G -- "Yes (warm tab return)" --> D G -- "No" --> EChanges
crates/session-view/src/timeline/mod.rs: Computesrow_height::heights_version(...)whens.transcript_version(&id)isSome(tv)and passes.virtual_row_heights_version(hv)beside.virtual_rows_version(version). Unversioned hosts (e.g.story::Host) omit the stamp and keep per-commit scanning.crates/session-view/src/timeline/projection.rs: Adds monotonicProjection::content_generation, incremented on everyProjection::neweven whensame_keysreusesgeneration(solive,streaming,pt,under,divider,above,below, andtopchanges invalidateheights_version).crates/session-view/src/recall.rs: Adds globally uniqueMarks::id(NEXT_MARKS_ID) and monotonicresting_gen: Rc<Cell<u64>>, exposed viaMarks::resting_stamp() -> (u64, u64). Bumped on shapedprepare_rowchange, shapedon_layout_anyw/hchange, shapedshownLRU eviction, andMarksrecreation afterforget/retain.crates/session-view/src/timeline/row_height.rs:heights_version(...)guarded byrune::tracked::Paused::new()so reading non-Tracked/ version inputs never subscribestimeline-fadeto extra cells (media_store,speech, etc.). AllTrackedcells read byshape(expanded,code_wrap_overrides,working_state,line_hold,diagrams,media_store,user_status_version,model_name,user_glow_at,MATH_GEN) invalidate per-scan via Rune'stracked_reads(!stamp.reads.changed(), preserved across warmRecentVirtualsrestores), avoiding both region over-invalidation andO(disclosures)scans on streaming deltas.MATH_GEN: rune::Tracked<()>(note_math_changed(),record_math_read(),math_version()) so finished LaTeX renders invalidatesync_known_heights_checkedviastamp.reads(without rebuildingtimeline-fade) and viaheights_versionon tab return.row_height::shape: stack-bufferedwith_fold_key([u8; 96], overflow-safe length check, safestr::from_utf8) with singleexpanded.getlookup; single-pass borrowedquote_open_stamp; borrowedhash_prompt_meta(short-circuits onnarrow(), avoidsVec/ModelRef::clone/ uppercaseString/ redundant backward scan); removes anchor-onlyfold::is_past; gatesrune_kit::math::version(&r.key)onscan.has(FLAG_MATH).crates/session-view/src/lib.rs: Callstimeline::note_math_changed()insidepoll_mathwhenrune_kit::math::Client::changedreturnstrue.Streaming &
append_onlybehaviortimeline/mod.rsdoes not set.virtual_rows_append_only(), soappended_fromisNoneand any row count or key change re-keys (finish_rekeyclearsheights_cache.stamp) and runs a full scan..virtual_rows_append_only()is added later,heights_versionincludestranscript_ver,specs.generation,specs.content_generation, andspecs.len(), preventingsync_known_heights_suffixfrom skipping mutated prior rows.Input checklist (
virtual_row_heights+Marks::height_for+row_height::{layout, shape})heights_version(Paused)sync_known_heights_checked(stamp.reads/KnownHeightsKey)idmod.rs:300sessionshownintimeline-fadeinputstmod.rs:300,row_height.rstranscript_ver(Noneomits stamp)shown_transcript_stamp(shown)ininputsmod.rs:301specs.generation,specs.len()same_keys&stamp.item_count == lenlive,streaming,pt,under,divider,above,below,top)row_height.rsspecs.content_generationRc<Projection>Recall/Marks(shape,target, LRU,forget/retain)recall.rsmarks.resting_stamp()v.measured[r]Marks::drawnspring settlerecall.rsv.measured[r] == target.h; evicted list hasstamp == Nonev.measured[r]row_height::layoutrow_height.rs:94-119layoutu64+ RuneKnownHeightsKeyfold::viewportrow_height.rslayoutKnownHeightsKeyexactbound_bits&committed_cross_bitss.fold_user_messages(),s.assistive(),style::narrow()row_height.rsTracked<Settings>/inputs/bound_bitsuser_comments(id)row_height.rsprompt_extras_generation()variantuser_mentions(id)row_height.rstranscript_ver(note:set_user_mentionsinopencode-kitdoes not callextras_changed(), left out of scope)shown_transcript_stamps.diagrams().hidden_in(body)row_height.rscrate::diagram::shown_id()Tracked<Diagrams>instamp.readss.media_store().{markdown,videos}.version()row_height.rs(markdown.version(), videos.version())Tracked<MediaStore>instamp.readsrune_kit::math::version(&r.key)row_height.rsmath_version()MATH_GEN(Tracked<()>) instamp.readswhenFLAG_MATH, touched inpoll_maths.expanded(),s.code_wrap_overrides(),s.working_state(),s.line_hold(),s.user_status_version(),s.model_name(),s.user_glow_at()row_height.rsstamp.reads(zeroO(disclosures)scan / zerotimeline-fadeleak)Trackedreads captured per-scan instamp.reads(preserved acrossRecentVirtualsrestore)