Skip to content

Load the package with pkgload instead of devtools - #1

Merged
ashbaldry merged 2 commits into
mainfrom
perf/replace-devtools-with-pkgload
Aug 7, 2026
Merged

Load the package with pkgload instead of devtools#1
ashbaldry merged 2 commits into
mainfrom
perf/replace-devtools-with-pkgload

Conversation

@ac-acuity

Copy link
Copy Markdown
Collaborator

app.R used devtools::load_all(). shinylive scans app.R when working out what to bundle, so devtools and its 46 package import tree ended up in the wasm payload every visitor downloads.

That is 14.8 MB and 47 extra downloads. webR fetches packages one at a time over synchronous XHR, so the round trips cost as much as the bytes. None of it is usable in a browser anyway.

devtools::load_all() is a thin wrapper around pkgload::load_all(), so this is a straight swap. pkgload brings 6 packages and 1.2 MB. Net saving is 41 packages and 13.6 MB off first load.

Note that library(dtlgdemo) does not work here. The package is not in the wasm repo, so the app relies on loading from bundled source.

Measured against the packages currently served from the live site.

Andrei Constantinescu and others added 2 commits August 7, 2026 15:49
shinylive scans app.R for dependencies, so devtools::load_all() pulled
devtools and its 46 package import tree into the wasm bundle. That is
14.8 MB and 47 extra serial downloads before the app can start, none of
which do anything useful in a browser.

devtools::load_all() is a thin wrapper around pkgload::load_all(), so
this is a direct swap. pkgload costs 6 packages and 1.2 MB.

Net saving is 41 packages and 13.6 MB off first load.
@ashbaldry
ashbaldry merged commit 0a141e6 into main Aug 7, 2026
7 checks passed
@ashbaldry
ashbaldry deleted the perf/replace-devtools-with-pkgload branch August 7, 2026 16:29
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 this pull request may close these issues.

2 participants