Skip to content

Add support for binary compression of widget data#498

Open
andrjohns wants to merge 1 commit into
ramnathv:masterfrom
andrjohns:compression
Open

Add support for binary compression of widget data#498
andrjohns wants to merge 1 commit into
ramnathv:masterfrom
andrjohns:compression

Conversation

@andrjohns

Copy link
Copy Markdown

When creating files with multiple widgets and large input data, the resulting HTML filesize is dominated by the embedded JSON data.

This PR introduces the option (disabled by default): htmlwidget.compress_payload, to store widget data as a compressed binary string. Decompression is handled by the fflate library - only the unzlibSync and strFromU8 functions are bundled, resulting in only 5kb (minified) added to the output.

In our local testing this reduced the output size for one of our HTML files from 55mb -> 10mb, with little lag in the initial rendering time.

Let me know if I've missed anything, or if there's a better way to do this, thanks!

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