Skip to content
Prev 55836 / 63424 Next

memory footprint of readRDS()

The ratio of object size to rds file size depends on the object.  Some
variation is due to how header information is stored in memory and in the
file but I suspect most is due to how compression works (e.g., a vector of
repeated values can be compressed into a smaller file than a bunch of
random bytes).

f <- function (data, ...)  {
    force(data)
    tf <- tempfile()
    on.exit(unlink(tf))
    save(data, file = tf)
    c(`obj/file size` = as.numeric(object.size(data)/file.size(tf)))
}
obj/file size
     1021.456
obj/file size
    0.9999986
obj/file size
     682.6555
obj/file size
     1.309126
obj/file size
     2021.744
obj/file size
     8.907579
obj/file size
    0.9998433
obj/file size
     254.5595
obj/file size
      23.5567



Bill Dunlap
TIBCO Software
wdunlap tibco.com
On Tue, Sep 18, 2018 at 8:28 AM, Joris Meys <jorismeys at gmail.com> wrote: