bcallaway11 / did

Difference in Differences with Multiple Periods, website: https://bcallaway11.github.io/did
288 stars 92 forks source link

Speed up compute.att_gt #100

Closed kylebutts closed 2 years ago

kylebutts commented 2 years ago

Optimized compute.att_gt. Within the double for loop (g and t), the entire dataset was being copied every iteration and variables were being created. This is particularly helpful for large datasets where copying is a large operation. It's about a 10% speedup for not much refactoring.

@bcallaway11 @pedrohcgs All the tests run successfully including the slow inference.Rmd code. The only thing is the testthat inference checks as I don't have the old_packages folder setup.

bcallaway11 commented 2 years ago

Thanks, @kylebutts

I ran those extra tests that you mention, and they run fine. In the future, I might separate out some of those tests that rely on having that extra folder. Some of those inference tests are just about making sure that nothing changes across versions of our code, but others aren't and they could be separate...