Skip to content

[ntuple] Resize RVecs geometrically - #23718

Merged
jblomer merged 5 commits into
root-project:masterfrom
jblomer:ntuple-rvec-growth
Oct 16, 2026
Merged

jblomer merged 5 commits into
root-project:masterfrom
jblomer:ntuple-rvec-growth

Conversation

@jblomer

@jblomer jblomer commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

Extended version of #23685

ishaaaan17 and others added 2 commits October 14, 2026 11:30
When reading consecutive entries with variable-sized RVec collections, ResizeRVec previously reallocated only enough capacity for nItems. This incurred frequent reallocations across entries with growing element counts.

Grow capacity geometrically (doubling, capped at int32_t max) when reallocating an already-allocated RVec, amortizing allocation costs and avoiding repeated malloc/free cycles across entry iterations.

Assisted-by: antigravity:gemini
Grow by doubling until 16 items, then grow only by 50%.
Comment thread tree/ntuple/src/RFieldSequenceContainer.cxx
Comment thread tree/ntuple/src/RFieldSequenceContainer.cxx
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Test Results

    24 files      24 suites   3d 23h 41m 12s ⏱️
 3 889 tests  3 888 ✅ 0 💤 1 ❌
83 246 runs  83 245 ✅ 0 💤 1 ❌

For more details on these failures, see this check.

Results for commit 5e19ae3.

♻️ This comment has been updated with latest results.

@jblomer
jblomer force-pushed the ntuple-rvec-growth branch from 7ba02b4 to dfa2a7c Compare October 14, 2026 20:26
As we now grow geometrically, also shrink geometrically. Half the
capacity when the size falls below 1/4.
@jblomer
jblomer requested a review from pcanal October 14, 2026 20:29
Comment thread tree/ntuple/src/RFieldSequenceContainer.cxx Outdated
Co-authored-by: Philippe Canal <pcanal@fnal.gov>

@pcanal pcanal left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks.

@pcanal pcanal closed this Oct 15, 2026
@pcanal pcanal reopened this Oct 15, 2026
@jblomer
jblomer force-pushed the ntuple-rvec-growth branch from 7875428 to 5e19ae3 Compare October 15, 2026 19:01
Co-authored-by: Philippe Canal <pcanal@fnal.gov>
@jblomer
jblomer merged commit bde4d7e into root-project:master Oct 16, 2026
34 of 36 checks passed
@jblomer
jblomer deleted the ntuple-rvec-growth branch October 16, 2026 09:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants