brodieG / unitizer

Easy R Unit Tests
Other
39 stars 7 forks source link

RDS not an interchange format #287

Closed brodieG closed 2 years ago

brodieG commented 2 years ago

From ?readRDS:

Files produced by saveRDS (or serialize to a file connection) are not suitable as an interchange format between machines, for example to download from a website. The files produced by save have a header identifying the file type and so are better protected against erroneous use.

Figure out exactly how this affects unitizer use of RDS files. Is this an endianess issue, or just that there is some standard requiring file self-identification for interchange?

brodieG commented 2 years ago

This does not actually seem to be an issue for our purposes where there is no ambiguity what the file is and how it should be read. At least it seems to be the case the warning intends to alert that you cannot expect someone to download the file and have their OS know what to do with it. From ?serialize:

As almost all systems in current use are little-endian, xdr = FALSE can be used to avoid byte-shuffling at both ends when transferring data from one little-endian machine to another (or between processes on the same machine). Depending on the system, this can speed up serialization and unserialization by a factor of up to 3x.