[R-pkg-devel] how to prevent a small package from yielding a large installed size?

Daniel Kelley D@n@Ke||ey @end|ng |rom D@|@C@
Mon Jun 15 18:30:15 CEST 2020


Duncan, thanks very much for that very helpful hint.  I got as follows.  My guess is that the first column in rdx$variables is an address offset, and so it seems that the lion's share of the storage is dedicated to items with names starting with a decimal point.  For example, the "[[" item is at offset of nearly 4M.  I may try fiddling with my code in which I specialize that method, to see whether I can reduce the memory footprint.  From what I can gather, both linux and windows build argoFloats into a package with R directory of about 2.5M size, which is a lot better than what I get in macOS but still over the warning threshold (I think) and therefore I worry about CRAN acceptance.

R version 4.0.1 (2020-06-06) -- "See Things Now"
Copyright (C) 2020 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin17.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> rdx <- readRDS("~/Library/R/4.0/library/argoFloats/R/argoFloats.rdx")
> sizes <- sapply(rdx$variables, function(n) n[2])
> cat(str(rdx$variables))
List of 23
 $ .__C__argoFloats        : int [1:2] 0 299
 $ .__NAMESPACE__.         : int [1:2] 1431 51
 $ .__S3MethodsTable__.    : int [1:2] 1611 51
 $ .__T__[[:base           : int [1:2] 3914410 51
 $ .__T__initialize:methods: int [1:2] 4075727 53
 $ .__T__merge:base        : int [1:2] 4174252 53
 $ .__T__plot:base         : int [1:2] 6684924 53
 $ .__T__show:methods      : int [1:2] 6761290 53
 $ .__T__subset:base       : int [1:2] 7255136 53
 $ .__T__summary:base      : int [1:2] 7476028 53
 $ .packageName            : int [1:2] 7476081 54
 $ argoFloatsDebug         : int [1:2] 7476135 2035
 $ argoUseAdjusted         : int [1:2] 7478170 3736
 $ downloadWithRetries     : int [1:2] 7481906 3369
 $ geographical            : int [1:2] 7485275 40
 $ getIndex                : int [1:2] 7485315 9870
 $ getProfileFromUrl       : int [1:2] 7495185 1337
 $ getProfiles             : int [1:2] 7496522 2843
 $ merge                   : int [1:2] 7499365 455
 $ plot                    : int [1:2] 7499820 455
 $ readProfiles            : int [1:2] 7500275 6887
 $ subset                  : int [1:2] 7507162 443
 $ summary                 : int [1:2] 7507605 447
> sum(sizes)
[1] 32741
> system("ls -l ~/Library/R/4.0/library/argoFloats/R/argoFloats.rdb")
-rw-r--r--  1 kelley  staff  7508052 15 Jun 07:47 /Users/kelley/Library/R/4.0/library/argoFloats/R/argoFloats.rdb
>







On Jun 15, 2020, at 10:50 AM, Duncan Murdoch <murdoch.duncan using gmail.com<mailto:murdoch.duncan using gmail.com>> wrote:

rdx <- readRDS("foo.rdx")
sizes <- sapply(rdx$variables, function(n) n[2])


	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list