Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

including renv.lock in writeManifest degrades performance #930

Closed
edavidaja opened this issue Jul 24, 2023 · 1 comment · Fixed by #931
Closed

including renv.lock in writeManifest degrades performance #930

edavidaja opened this issue Jul 24, 2023 · 1 comment · Fixed by #931

Comments

@edavidaja
Copy link

It's not necessarily clear that you don't need to select the renv.lock file for rsconnect to respect it during deployment, but if you do it really slows things down:

> bench::mark(
+     rsconnect::writeManifest(appFiles = c("index.qmd")),
+     rsconnect::writeManifest(appFiles = c("index.qmd", "renv.lock")), iterations = 3
+ )
ℹ Capturing R dependencies with renvFound 118 dependenciesCapturing R dependencies from renv.lockFound 121 dependencies
# A tibble: 2 × 13
  expression                                                       min median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time result memory     time       gc      
  <bch:expr>                                                    <bch:> <bch:>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm> <list> <list>     <list>     <list>  
1 "rsconnect::writeManifest(appFiles = c(\"index.qmd\"))"        7.79s  7.88s    0.126      119MB    0.796     3    19     23.86s <NULL> <Rprofmem> <bench_tm> <tibble>
2 "rsconnect::writeManifest(appFiles = c(\"index.qmd\", \"renv… 34.39s 35.89s    0.0281     121MB    0.187     3    20      1.78m <NULL> <Rprofmem> <bench_tm> <tibble>

using latest rsconnect / renv from github:

> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.2.3 (2023-03-15)
 os       Ubuntu 22.04.2 LTS
 system   x86_64, linux-gnu
 ui       RStudio
 language en_US:en
 collate  en_US.UTF-8
 ctype    en_US.UTF-8
 tz       UTC
 date     2023-07-24
 rstudio  2023.06.0+421.pro1 Mountain Hydrangea (server)
 pandoc   3.1.4 @ /usr/home/david/.linuxbrew/bin/ (via rmarkdown)

─ Packages ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
 ! package     * version    date (UTC) lib source
 P bench         1.1.3      2023-05-04 [?] RSPM (R 4.2.0)
 P bit           4.0.5      2022-11-15 [?] RSPM (R 4.2.0)
 P bit64         4.0.5      2020-08-30 [?] RSPM (R 4.2.0)
 P blob          1.2.4      2023-03-17 [?] RSPM (R 4.2.0)
 P cachem        1.0.8      2023-05-01 [?] RSPM (R 4.2.0)
 P cellranger    1.1.0      2016-07-27 [?] RSPM (R 4.2.0)
 P cli           3.6.1      2023-03-23 [?] RSPM (R 4.2.0)
 P DBI           1.1.3      2022-06-18 [?] RSPM (R 4.2.0)
 P digest        0.6.31     2022-12-11 [?] RSPM (R 4.2.0)
 P evaluate      0.21       2023-05-05 [?] RSPM (R 4.2.0)
 P fansi         1.0.4      2023-01-22 [?] RSPM (R 4.2.0)
 P fastmap       1.1.1      2023-02-24 [?] RSPM (R 4.2.0)
 P generics      0.1.3      2022-07-05 [?] RSPM (R 4.2.0)
 P glue          1.6.2      2022-02-24 [?] RSPM (R 4.2.0)
 P htmltools     0.5.5      2023-03-23 [?] RSPM (R 4.2.0)
 P janitor       2.2.0      2023-02-02 [?] RSPM (R 4.2.0)
 P jsonlite      1.8.5      2023-06-05 [?] RSPM (R 4.2.0)
 P knitr         1.43       2023-05-25 [?] RSPM (R 4.2.0)
 P lifecycle     1.0.3      2022-10-07 [?] RSPM (R 4.2.0)
 P lubridate     1.9.2      2023-02-10 [?] RSPM (R 4.2.0)
 P magrittr      2.0.3      2022-03-30 [?] RSPM (R 4.2.0)
 P memoise       2.0.1      2021-11-26 [?] RSPM (R 4.2.0)
 P pillar        1.9.0      2023-03-22 [?] RSPM (R 4.2.0)
 P pkgconfig     2.0.3      2019-09-22 [?] RSPM (R 4.2.0)
 P profmem       0.6.0      2020-12-13 [?] RSPM (R 4.2.0)
 P readxl        1.4.3      2023-07-06 [?] RSPM (R 4.2.0)
   renv          1.0.0.9000 2023-07-24 [1] Github (rstudio/renv@5a23148)
 P rlang         1.1.1      2023-04-28 [?] RSPM (R 4.2.0)
 P rmarkdown     2.23       2023-07-01 [?] RSPM (R 4.2.0)
 P rsconnect     1.0.1.9000 2023-07-24 [?] Github (rstudio/rsconnect@a5db832)
 P RSQLite       2.3.1      2023-04-03 [?] RSPM (R 4.2.0)
 P rstudioapi    0.15.0     2023-07-07 [?] RSPM (R 4.2.0)
 P sessioninfo   1.2.2      2021-12-06 [?] RSPM (R 4.2.0)
 P snakecase     0.11.0     2019-05-25 [?] RSPM (R 4.2.0)
 P stringi       1.7.12     2023-01-11 [?] RSPM (R 4.2.0)
 P stringr       1.5.0      2022-12-02 [?] RSPM (R 4.2.0)
 P tibble        3.2.1      2023-03-20 [?] RSPM (R 4.2.0)
 P tidyselect    1.2.0      2022-10-10 [?] RSPM (R 4.2.0)
 P timechange    0.2.0      2023-01-11 [?] RSPM (R 4.2.0)
 P utf8          1.2.3      2023-01-31 [?] RSPM (R 4.2.0)
 P vctrs         0.6.2      2023-04-19 [?] RSPM (R 4.2.0)
 P writexl       1.4.2      2023-01-06 [?] RSPM (R 4.2.0)
 P xfun          0.39       2023-04-20 [?] RSPM (R 4.2.0)
 P yaml          2.3.7      2023-01-23 [?] RSPM (R 4.2.0)

 [1] /usr/home/david/xlio/renv/library/R-4.2/x86_64-pc-linux-gnu
 [2] /usr/home/david/.cache/R/renv/sandbox/R-4.2/x86_64-pc-linux-gnu/e11edd0e

 P ── Loaded and on-disk path mismatch.

─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@hadley
Copy link
Member

hadley commented Jul 24, 2023

I think this is the note I have in my personal todo: "check for status() before doing a restore()". I'll take a look this afternoon.

hadley added a commit that referenced this issue Jul 24, 2023
Previously we'd always restore the packages from the lockfile, which I had expected to be fast since I had expected the packages to be in the cache. However, this doesn't appear to always be the case, so I instead use a simpler approach where I just force the user to resolve the problem. This means that we can always use the `DESCRIPTION` present in the `.libPaths()` making the code much simpler.

Fixes #930
hadley added a commit that referenced this issue Jul 25, 2023
Previously we'd always restore the packages from the lockfile, which I had expected to be fast since I had expected the packages to be in the cache. However, this doesn't appear to always be the case, so I instead use a simpler approach where I just force the user to resolve the problem. This means that we can always use the `DESCRIPTION` present in the `.libPaths()` making the code much simpler.

Fixes #930
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants