Chunk pack: combine a carried run once, when emitted - #902
Open
frankmcsherry wants to merge 1 commit into
Open
frankmcsherry wants to merge 1 commit into
frankmcsherry wants to merge 1 commit into
Conversation
`pack` grew its carry by `combine(&mut acc, next)`, which is linear only if appending leaves `acc` in place. Corgi's combine rebuilds its columns, so a carry absorbing many small chunks recopied itself each time: over scc's churn rounds it recopied 30.7M carried rows to append 2.3M new ones. The carry is now a run of chunks, combined once when emitted; between calls the run goes back to the input uncombined. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013ABLpEcZUPN1oAUY2usfkx
This branch has not been deployed
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.
pack(the maximal-packing helper behindChunk::settle) grew its carry withcombine(&mut acc, next). That is linear only when appending leavesaccin place, asVecdoes. Corgi's combine rebuilds its columns, so a carry absorbing many small chunks recopied itself every time. Over scc's churn rounds that was 30.7M carried rows recopied to append 2.3M new ones (counted).Now the carry is a run of chunks, and
combine(run)is called once, when the run is emitted. Between calls the run goes back to the input uncombined. The three implementations change to match: vec concatenates, columnar melds each trie onto the first, and corgi calls its existingconcat. The peel-an-oversized-chunk path is folded into the loop, sopack_absorbgoes. 46 lines added, 71 removed.One trade: a run handed back between calls is re-walked by the next call. That costs one deque pop and push per chunk, not a copy of its rows.
Churn, ms/round, corgi, 3 runs each (loads unchanged):
Validation: DD lib tests plus the
int_proxy,columnar,reduce_oracle,traceandscctests pass, as do all interactive tests. AoC 2023 passes 33/33 on both vec and corgi.columnar_spillspills the same 5425 chunks at the same rate.🤖 Generated with Claude Code