JuliaPluto / PlutoSliderServer.jl

Web server to run just the `@bind` parts of a Pluto.jl notebook
https://computationalthinking.mit.edu/
The Unlicense
130 stars 17 forks source link

Full bundling of precomputed slider states #118

Open ctrekker opened 1 year ago

ctrekker commented 1 year ago

This is a draft PR for a draft PR! Precomputed sliders require many files which are often small and very similar to one another. Bundling solves both these problems in one go:

  1. Bundles can be stored in a single larger file, which can be served statically in its compressed form to reduce size
  2. Notebook clients need only request a bundle once, meaning precomputed values contained within load instantly once the bundle has been downloaded

With the following notebook we see a massive 96% compression of the staterequest folder (where the notebook updates are stored)

BEFORE BUNDLING
17M     60qMnIsupXiarVwdoPP2Vg9cewKaBJfJTlSOgeeEtW0/
AFTER BUNDLING + COMPRESSION
608K    60qMnIsupXiarVwdoPP2Vg9cewKaBJfJTlSOgeeEtW0/

Screenshot from 2023-06-14 14-10-32

There are inherent limitations to this method, so this PR will not be helpful for all notebooks. For very large slider spaces, bundling the entire space will simply be too large to load in a browser. Future changes may or may not address this issue by implementing partial bundles which only include a certain carefully chosen subset of slider values.

EDIT: Complimentary changes to the sliderserver client are in fonsp/Pluto.jl#2585

fonsp commented 1 year ago

Super nice!!! Can you make a draft PR on the pluto side and link here?