Skip to content

tp: make FlexVector::shrink_to_fit a no-op at minimal capacity - #7198

Merged
LalitMaganti merged 2 commits into
mainfrom
dev/lalitm/flexvector-shrink
Aug 25, 2026
Merged

tp: make FlexVector::shrink_to_fit a no-op at minimal capacity#7198
LalitMaganti merged 2 commits into
mainfrom
dev/lalitm/flexvector-shrink

Conversation

@LalitMaganti

Copy link
Copy Markdown
Member

shrink_to_fit unconditionally reallocated and copied the storage even
when capacity was already the smallest legal size for the current
element count. Dataframe::Finalize calls it on every column of every
built dataframe, so each finalize silently copied all column storage.
That copy also defeats any downstream design that wants to share or
move finalized column storage instead of duplicating it.

Return early when the aligned size already equals capacity, making the
call free in the common already-minimal case.

shrink_to_fit unconditionally reallocated and copied the storage even
when capacity was already the smallest legal size for the current
element count. Dataframe::Finalize calls it on every column of every
built dataframe, so each finalize silently copied all column storage.
That copy also defeats any downstream design that wants to share or
move finalized column storage instead of duplicating it.

Return early when the aligned size already equals capacity, making the
call free in the common already-minimal case.
@LalitMaganti
LalitMaganti requested a review from a team as a code owner August 24, 2026 15:33
@github-actions

github-actions Bot commented Aug 24, 2026

Copy link
Copy Markdown

@LalitMaganti
LalitMaganti merged commit 747fbc2 into main Aug 25, 2026
28 checks passed
@LalitMaganti
LalitMaganti deleted the dev/lalitm/flexvector-shrink branch August 25, 2026 09:50
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.

2 participants