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

Size reduction aproaches #247

Open
agriyakhetarpal opened this issue Jan 9, 2025 · 1 comment
Open

Size reduction aproaches #247

agriyakhetarpal opened this issue Jan 9, 2025 · 1 comment
Labels
enhancement New feature or request needs more investigation This issue or pull request needs more investigation

Comments

@agriyakhetarpal
Copy link
Member

Currently, we generate notebooks for the TryExamples directive, and the JupyterLite, NotebookLite, and Voici directives can take a path to a notebook.

While we can disable the JupyterLite source maps to reduce build size (a technique used downstream in scikit-learn/scikit-learn#26246, numpy/numpy#26745, and sympy/sympy#27419), I've opened this issue as an open-ended item to see if jupyterlite-sphinx as a companion to JupyterLite can reduce its footprint by reducing the size of the notebooks that are eventually copied into the JupyterLite folder.

Reductions in sizes will be helpful for:

  • projects deploying documentation via GitHub Pages or on other static webpage hosts
  • reducing bandwidth usage for readers of said documentation
@agriyakhetarpal agriyakhetarpal added the enhancement New feature or request label Jan 9, 2025
@agriyakhetarpal
Copy link
Member Author

Okay, so, as an experiment, I tried reducing the size of the notebooks generated by the TryExamples directive – thinking that those notebooks have more significant numbers in comparison to the ones connected to the NotebookLite/JupyterLite directive(s) since they can quickly go into the thousands, based on how many docstrings exist in the entire documentation source for a package – sadly the results are not helpful. :(

By removing the outputs from the UUID-based notebooks from numpy/numpy#26745, the size of 1496 total notebooks was reduced from 4.5 MiB to 2.5 MiB, and a similar test for SymPy with 2519 notebooks/example revealed a reduction from 6.8 MiB to 3.9 MiB. Hence, this sounds like a paltry improvement of just 1.44% and is not really worth incorporating, especially when NumPy's total docs size without JupyterLite's source maps is ~138 MiB. Even with enabling global docstring examples for Matplotlib, which also uses Sphinx-Gallery and has a lot of images in its notebook outputs, I didn't see much of a reduction (20 MiB – brought down to 557 MiB).

I'll leave this issue open in case there's something I am missing in this aim to reduce the build size from jupyterlite-sphinx's side that anyone else can point out. Otherwise, we can close and try to find optimisation options in JupyterLite itself.

@agriyakhetarpal agriyakhetarpal added the needs more investigation This issue or pull request needs more investigation label Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs more investigation This issue or pull request needs more investigation
Projects
None yet
Development

No branches or pull requests

1 participant