-
Notifications
You must be signed in to change notification settings - Fork 19
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
Speed-up in bootweights
by using a function barrier
#290
Conversation
Codecov Report
@@ Coverage Diff @@
## v0.1.1 #290 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 12 12
Lines 187 200 +13
=========================================
+ Hits 187 200 +13
... and 2 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Hi @jishnub. Thanks for contributing to improve type stability in the package! We have been planning to overhaul the entire package for improving type stability issues. @ayushpatnaikgit and I will do a few more speed tests on some other datasets, but I think PR should be good to merge soon |
I changed merging branch from |
Co-authored-by: Anshul Singhvi <[email protected]>
@@ -24,27 +24,18 @@ replicates: 1000 | |||
function bootweights(design::SurveyDesign; replicates = 4000, rng = MersenneTwister(1234)) |
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.
Kind of unrelated, but why is the function named bootweights
? Could it be refactored to ReplicateDesign(design::SurveyDesign, ...)
? This would make the #292 approach a lot easier to implement. If it's an R function you want to wrap, there is always const bootweights = ReplicateDesign
or similar.
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.
There are several ways of making replicate weights. This is the first one that we have implemented.
We may choose your approach, we are thinking about the design in #292 and a couple of other issues.
Separating out the type-unstable and the type-stable parts leads to a moderate speed-up and a slight reduction in allocation. Using the example from the docstring of
bootweights
on the main branch, we obtain:This PR
A speedup of
13%