-
Notifications
You must be signed in to change notification settings - Fork 421
Immediately safe_import CMSHistFuncWrapper #1194
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
Conversation
…em - reduce time taken by ROOT.RooFit.RecycleConflictNodes to go through the dependency graph
WalkthroughRefactored import handling in ShapeBuilder to eliminate deferred batch imports. The Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1194 +/- ##
=======================================
Coverage 20.69% 20.69%
=======================================
Files 195 195
Lines 26156 26156
Branches 3923 3923
=======================================
Hits 5413 5413
Misses 20743 20743 🚀 New features to boost your workflow:
|
|
@guitargeek @anigamova do you see any potential problems with this? |
|
Well, I don't see a problem if the CI doesn't see a problem! The import order to workspaces doesn't matter |
|
That's interesting, because in this commit it was changed in the opposite direction but also for optimization reasons. @guitargeek do you recall if there is something that changed in the import behavior to give such an effect? |
|
Yes, I changed many things in the implementation some years ago, to make some ATLAS workspace imports faster. It's very likely that this has shifted the performance bottlenecks, so now importing early is faster. Maybe you can check performance with the different ROOT versions that Combine supports? |
|
OK, anyway I think it makes sense |
A huge part of the execution time when running
text2workspace.pyfor template models seems to be spent in importing into the workspace instances ofCMSHistFuncWrapper. This import usesROOT.Roofit.RecycleConflictNodes, which traverses the dependency graph and seems to grow non-linearly with the workspace size.Instead of importing all the instances of
CMSHistFuncWrapperat the end ofdoCombination, this PR moves the safe import right after the creation of each instance, when the workspace is less large, effectively reducing the time spent in traversing the graph and the overall runtime oftext2workspace.py.I tested this on the pT datacard of HIG-20-015 (see here) and the overall time to run the
text2workspace.pycommand decreased from 375.81s to 264s (measured with/usr/bin/time). In this case, the command created ~4000 of such wrappers when running t2w.Considering that it seems to much gain for such an easy fix, I expect that there is something that I overlooked and something to break somewhere else, so let's see if the tests are green.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.