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

Lazy load strategy for plotly bundle #1913

Closed
nrbgt opened this issue Nov 20, 2019 · 2 comments
Closed

Lazy load strategy for plotly bundle #1913

nrbgt opened this issue Nov 20, 2019 · 2 comments

Comments

@nrbgt
Copy link

nrbgt commented Nov 20, 2019

While having the plotly bundle be deduplicated between this and other extensions (#1891) would help some of the issues users are seeing, the fact still remains that, minified or unminified, the plotly bundle is enormous: even minified, it's 4mb size is close to the entire minified lab bundle (5.5mb, last i checked).

Not familiar with this code base and whichever other ones use the plotly bundle, the example for another heavy widget #1891 (comment) would at least get the bundle out of the critical path. It is likely worth investigating if there is a way to do it at a finer-grained level (e.g. just plotly itself) but then the additional points of asynchrony might need to be found.

As suggested in #1891 (comment), lazy loading the bundle would provide several benefits to end users:

  • less up-front time waiting for the "moons" animation for all users
  • less CPU used during a local webpack rebuild for those that aren't using hosted/pre-built lab applications

The only downside is there would be a (potentially noticeable on slower connections) delay when the first widget is requested.

@pragyagarg642
Copy link

I have actually done this in my local. I used dynamic imports to lazy load the plotly bundle in jupyterlab-plotly extension. It seems to be working fine on my local machine. Shall I submit a PR?

pragyagarg642 added a commit to pragyagarg642/plotly.py that referenced this issue Mar 10, 2020
With this change, plotly.js will be loaded on demand. This uses dynamic
imports to achieve this.

Fixes plotly#1913
pragyagarg642 added a commit to pragyagarg642/plotly.py that referenced this issue Mar 31, 2020
With this change, plotly.js will be loaded on demand. This uses dynamic
imports to achieve this.

Fixes plotly#1913
pragyagarg642 added a commit to pragyagarg642/plotly.py that referenced this issue Mar 31, 2020
Currently plotly.js is bundled with the main bundle which increases
the size of bundle drastically and jupyterlab takes a lot of time to
load. With this change, plotly.js will be loaded on demand. This uses
dynamic imports to achieve this.

Fixes plotly#1913
pragyagarg642 added a commit to pragyagarg642/plotly.py that referenced this issue Apr 15, 2020
Currently plotly.js is bundled with the main bundle which increases
the size of bundle drastically and jupyterlab takes a lot of time to
load. With this change, plotly.js will be loaded on demand. This uses
dynamic imports to achieve this.

Fixes plotly#1913
pragyagarg642 added a commit to pragyagarg642/plotly.py that referenced this issue Apr 15, 2020
Currently plotly.js is bundled with the main bundle which increases
the size of bundle drastically and jupyterlab takes a lot of time to
load. With this change, plotly.js will be loaded on demand. This uses
dynamic imports to achieve this.

Fixes plotly#1913
nicolaskruchten pushed a commit that referenced this issue May 9, 2020
With this change, plotly.js will be loaded on demand. This uses dynamic
imports to achieve this.

Fixes #1913
@nicolaskruchten
Copy link
Contributor

This is (finally) closed as part of #3142

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 a pull request may close this issue.

3 participants