r-lib / R6

Encapsulated object-oriented programming for R
https://R6.r-lib.org
Other
403 stars 56 forks source link

Save R6 object #254

Open MathieuDepetris opened 2 years ago

MathieuDepetris commented 2 years ago

Hi all, I am developing an R package called t3 (https://github.com/OB7-IRD/t3/tree/development) using R6 classes. So far everything works fine but I have some troubles when I tried to save a R6 object after data manipulation and application of several methods. Saving and loading time is very long, even if at the end the output file generated is approximately 100mo. I tried to investigate that and make some kind of profiling and used different saving methods, but I find some post on the internet that makes me wonder is the problem came from me (for example here Serializing R6 classes? · Issue #157 · r-lib/R6 (github.com)). Do there any specifications related to the saving process of R6 object under R ? Thank for help.

d-sharpe commented 1 year ago

@MathieuDepetris I've encountered a similar problem before, specifically an dramatic increase in memory consumption on load. I ended up putting pickleR together to solve my issue. Not sure if it will sort your issue. Should be noted that it currently does not support the 'pickling' of S4 objects if you have any.

MathieuDepetris commented 1 year ago

@d-sharpe, thank you very much for your advice