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

Allow optionally compressed VFS image data #460

Merged
merged 4 commits into from
Aug 2, 2024
Merged

Conversation

georgestagg
Copy link
Member

@georgestagg georgestagg commented Jul 18, 2024

Uses pako for fast decompression of VFS images before mounting.

In principle static file web servers can serve content gzip compressed, but in practice it turns out services like GitHub Pages only compress certain types of object, likely based on MIME type.

From experimentation, it looks like VFS images with names ending in .data are not compressed over the wire, and so pre-compression with gzip can be useful when deploying webR to such services.

Using pako should be faster than R's built in .tar.gz decompressor, and is not a heavy prerequisite.

Note: Using Emscripten's --lz4 in file_packager is not a great fit here, because we do not directly execute the .js output from that tool. Instead we manually mount the image using MEMFS.mount(). Unfortunately, with that workflow the .js.metadata file does not actually contain all the required metadata to decompress the VFS contents.

Note: Once merged and included in a release, {rwasm} can be tweaked to include compressed R packages. Then, once R 4.5.0 is released we can turn off the uncompressed output.

@georgestagg georgestagg merged commit 777a32b into main Aug 2, 2024
4 checks passed
@georgestagg georgestagg deleted the compress-vfs branch August 2, 2024 08:04
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.

1 participant