Skip to content

Reduce package(s) size #87

@pawelru

Description

@pawelru

Have a look at the formatters:

❯ R CMD BUILD formatters
* checking for file ‘formatters/DESCRIPTION’ ... OK
* preparing ‘formatters’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* building ‘formatters_0.5.9.9003.tar.gz’

❯ tar -tzvf formatters_0.5.9.9003.tar.gz | sort -k3 -hr
-rw-r--r--  0 ruckip staff 1847812 Dec  6  2023 formatters/man/figures/logo.png
-rw-r--r--  0 ruckip staff  925622 Nov  6  2023 formatters/data/ex_advs.rda
-rw-r--r--  0 ruckip staff  629211 Nov  6  2023 formatters/data/ex_adqs.rda
-rw-r--r--  0 ruckip staff  493724 Nov  6  2023 formatters/data/ex_adlb.rda
-rw-r--r--  0 ruckip staff   58553 Jun 10 11:05 formatters/R/pagination.R
-rw-r--r--  0 ruckip staff   58457 Nov  6  2023 formatters/data/ex_adae.rda
-rw-r--r--  0 ruckip staff   56998 Jun 10 11:05 formatters/R/tostring.R
-rw-r--r--  0 ruckip staff   50367 Nov  6  2023 formatters/data/ex_admh.rda
-rw-r--r--  0 ruckip staff   48949 Nov  6  2023 formatters/data/ex_adcm.rda
-rw-r--r--  0 ruckip staff   45794 Oct 11 10:16 formatters/R/matrix_form.R
-rw-r--r--  0 ruckip staff   43801 Nov  6  2023 formatters/data/ex_adaette.rda
-rw-r--r--  0 ruckip staff   42991 Nov  6  2023 formatters/data/ex_adrs.rda
-rw-r--r--  0 ruckip staff   42770 Nov  6  2023 formatters/data/ex_adtte.rda
-rw-r--r--  0 ruckip staff   28158 Aug 13 14:33 formatters/tests/testthat/test-formatters.R
-rw-r--r--  0 ruckip staff   25210 Nov 14 18:02 formatters/inst/doc/formatters.html
-rw-r--r--  0 ruckip staff   23892 Jun 10 11:05 formatters/R/mpf_exporters.R
(...)

when untared:

❯ total_size=$(du -sk . | awk '{print $1}')
find . -type f -exec du -sk {} + | awk -v total_size=$total_size '{printf "%s %d KB (%.2f%%)\n", $2, $1, ($1/total_size)*100}' | sort -k2,2nr
./man/figures/logo.png 1808 KB (37.05%)
./data/ex_advs.rda 904 KB (18.52%)
./data/ex_adqs.rda 616 KB (12.62%)
./data/ex_adlb.rda 484 KB (9.92%)
./R/pagination.R 60 KB (1.23%)
  • 37% of package size is consumed by the logo alone!
  • looking into the codebase of that repo - we are not using ex_ datasets at all. But it might be used elsewhere. There are few packages that are using ex_adlb but I cannot find any usage of ex_advs and ex_adqs.

Adding this in general task repo to repeat the analysis for multiple packages and find a common solution.

It's important because of:

  • R CMD CHECK note about size
  • WebR with package downloads on the client (website user) side so we aim to have small and fast installable packages. I'm seeing two ways of doing this: limiting deps (not discussed here) and reducing the size (this issue). Currently it's neither good or bad. Have a look at the below extract from a random shinylive teal app in the tlg-catalog (devtools in chrome - network tab - open shinylive tab). This is filtered to downloaded .tgz files and order by size.
    image

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions