-
Notifications
You must be signed in to change notification settings - Fork 21
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
perf: cache yield_stdev using spec and interpcodes of model #322
perf: cache yield_stdev using spec and interpcodes of model #322
Conversation
... instead of the model itself. In effect, this makes the cache treat models like a value-typed hash. In current pyhf (0.6.4 and below) Model inherits __hash__ from object, so caching on model instances treats copies as different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for implementing this! This is super useful to prevent accidental re-computation of computationally expensive results.
Codecov Report
@@ Coverage Diff @@
## master #322 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 23
Lines 1881 1889 +8
Branches 305 306 +1
=========================================
+ Hits 1881 1889 +8
Continue to review full report at Codecov.
|
Thank you very much for the PR, this all looks good to me. I'd like to see whether we can get a resolution of scikit-hep/pyhf#1762 (comment), but as far as I can tell this has no impact for the equality comparison done here (where we care about equal |
Thanks for reviewing! I added the warning to the docstring. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks again!
This implements the changes to hashing discussed in #315.
It was necessary to modify one test that was directly looking up cached results in the
yield_stdev
cache.