Speed-up in bootweights by using a function barrier#290
Speed-up in bootweights by using a function barrier#290ayushpatnaikgit merged 2 commits intoxKDR:v0.1.1from
bootweights by using a function barrier#290Conversation
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 <anshulsinghvi@gmail.com>
| @@ -24,27 +24,18 @@ replicates: 1000 | |||
| function bootweights(design::SurveyDesign; replicates = 4000, rng = MersenneTwister(1234)) | |||
There was a problem hiding this comment.
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.
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
bootweightson the main branch, we obtain:This PR
A speedup of
13%