Skip to content

[6.40] [RF] Speed up CodegenContext::beginLoop() with single graph traversal - #23326

Merged
guitargeek merged 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_23313
Sep 9, 2026
Merged

[6.40] [RF] Speed up CodegenContext::beginLoop() with single graph traversal#23326
guitargeek merged 1 commit into
root-project:v6-40-00-patchesfrom
root-project-bot:BP_6.40_pull_23313

Conversation

@root-project-bot

Copy link
Copy Markdown

Backport of #23313, requested by @guitargeek.

To figure out which vector observables to loop over, beginLoop() called
RooAbsArg::dependsOn() once per vector observable. These dependsOn()
walks don't deduplicate visited nodes, so their cost scales with the
number of paths in the computation graph instead of the number of
nodes, which gets very expensive for large models with many shared
nodes.

Replace the per-observable walks with a single depth-first traversal
that visits every node only once and collects the reachable vector
observables, which is equivalent.

For the ATLAS VHbb benchmark workspace from rootbench, this reduces the
"Function JIT time" of the codegen backend (which includes the code
generation itself) from 9.4 s to 5.3 s.

🤖 Done with the help of AI

(cherry picked from commit 76babf1)
@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown

Test Results

    22 files      22 suites   3d 11h 10m 7s ⏱️
 3 877 tests  3 877 ✅ 0 💤 0 ❌
77 398 runs  77 398 ✅ 0 💤 0 ❌

Results for commit 2f76bed.

@guitargeek
guitargeek merged commit 8c949c5 into root-project:v6-40-00-patches Sep 9, 2026
41 checks passed
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