Skip to content

[RF] Serialize RooWorkspace snapshots in a more compressed way #19380

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guitargeek
Copy link
Contributor

This commit eliminates the huge overhead when storing parameter snapshots in a RooWorkspace.

A "snapshot" actually needs to contain very little info. What's happening right now is that for storing a Snapshot, RooFit creates a RooRealVar clone for each variable, which is
sizeof(RooRealVar) = 1000 bytes plus manually-allocated overhead (e.g. for binning info).

This memory overhead can be eliminated in the custom RooWorkspace::Streamer, only storing the information necessary for a snapshot. And when reading back the file, the RooRealVar clones will be instantiated so there is not change in behavior for the user.

Closes #18032.

@guitargeek guitargeek self-assigned this Jul 15, 2025
@guitargeek guitargeek requested a review from lmoneta as a code owner July 15, 2025 14:00
@guitargeek guitargeek changed the title [RF] Serialize RooWorkspace snapshots is a better way [RF] Serialize RooWorkspace snapshots in a more compressed way Jul 15, 2025
@guitargeek guitargeek force-pushed the issue-18032 branch 2 times, most recently from 7dc7ef7 to 42cf411 Compare July 15, 2025 14:12
Copy link

github-actions bot commented Jul 16, 2025

Test Results

    21 files      21 suites   3d 7h 20m 5s ⏱️
 3 217 tests  3 217 ✅ 0 💤 0 ❌
65 834 runs  65 834 ✅ 0 💤 0 ❌

Results for commit 701a694.

♻️ This comment has been updated with latest results.

This commit eliminates the *huge* overhead when storing parameter
snapshots in a RooWorkspace.

A "snapshot" actually needs to contain very little info. What's
happening right now is that for storing a Snapshot, RooFit creates a
`RooRealVar` clone for each variable, which is
`sizeof(RooRealVar) = 1000` bytes plus manually-allocated overhead (e.g.
for binning info).

This memory overhead can be eliminated in the custom
`RooWorkspace::Streamer`, only storing the information necessary for a
snapshot. And when reading back the file, the `RooRealVar` clones will
be instantiated so there is not change in behavior for the user.

Closes root-project#18032.
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.

[RF] Creating snapshots blows up the size of RooWorkspace to easily reach 1GB buffer limit
1 participant