ipyvuetify
ipyvuetify copied to clipboard
lazy loading heavyweight dependencies in lab
thanks for ipyvuetify!
Problem
The core ipyvuetify bundles are very large (~1.8mb), and appear to block the load of the Lab application (e.g. when the "three moon" animation starts)... this is better than the bad old days where it would just make webpack fail, but still not a great experience.
Motivation
Over on jupyterlite, we've been tightening up the performance story, and use our docs site as a stress test. We include ipyvuetify, we've shaved off enough from the core that we're now starting to see extensions in our top-five blockers.
Proposed Solution
A quick fix for this is to use a lazy loading approach for the exports key. Basically, this would move the import of index.js into an async function, along with the theme side-effect. It may also require changing some webpack settings.
The one challenge is getting the version, which can't be lazy loaded: it may be sensible to split that, or accept having it captured in two places and adding a test to keep them in sync.
The bottom line trade will be a slight delay when the first widget this package provides is rendered, which is usually far less noticeable, as it's less likely the browser will be loading much else other than some websocket messages, vs start up time when likely hundreds of files are vying for a spot in the loading queue.
Related
Here's some prior art for adopting this approach from core, and other heavyweight plugins:
- https://github.com/jupyter-widgets/ipywidgets/blob/fbdbd005da4dc58994704f39bcc19a40bbecdec5/python/jupyterlab_widgets/src/plugin.ts#L301
- https://github.com/bqplot/bqplot/pull/1192
- https://github.com/jupyter-widgets/pythreejs/pull/297
- https://github.com/plotly/plotly.py/blob/master/packages/javascript/jupyterlab-plotly/src/jupyterlab-plugin.ts#L19
Cool, yeah, I think that makes sense.
Is it the same issue that is making the loading of voila based dashboard super slow when it includes ipyvuetify widgets ? (I'm speaking of the loading when voila read the cells, not the actual rendering)
I don't believe this impacts voila, which doesn't use lab extensions... yet.
I don't believe this impacts voila, which doesn't use lab extensions... yet.
😢 thanks for your reply... I'll keep an eye on this issue though as my devs are done using JupyterLab