Software
butcher

butcher

Reduce the size of model objects saved to disk

R

butcher reduces the memory footprint of fitted model objects in R by removing unnecessary components that often bloat models due to formula usage, captured environments, and non-selective object construction. The package preserves prediction functionality while stripping away redundant parts that aren’t needed for post-fit estimation.

The package provides weigh() and locate() functions to identify memory-heavy components, plus five axe methods (axe_call(), axe_ctrl(), axe_data(), axe_env(), axe_fitted()) to selectively remove specific parts of model objects. A convenience function butcher() executes all axing operations at once. This is particularly valuable when deploying models to production or storing many fitted models, where a model that should be 22 KB might otherwise consume 8 MB due to captured environments and unnecessary data.

Contributors