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

'pyodide-worker' export target loads slower than 'pyodide' #7061

Open
samimia-swks opened this issue Aug 2, 2024 · 2 comments
Open

'pyodide-worker' export target loads slower than 'pyodide' #7061

samimia-swks opened this issue Aug 2, 2024 · 2 comments

Comments

@samimia-swks
Copy link

samimia-swks commented Aug 2, 2024

I have a basic dashboard which I tried exporting (panel: 1.4.4, python 3.12.1) to both 'pyodide-worker' and 'pyodide' targets, and serving them with local web server (Five Server vscode extention).
The docs suggest the pyodide-worker method should be more performant, but at least when it comes to the initial load, it's a lot slower on both MS Edge (Win 11) and Chrome (Ubuntu). Is this expected?

Browser console log (Edge) for pyodide-worker below. First line is when I hit the reload button. "### DEBUG ###" lines are at the top of my python script (after the imports). It takes about 30 seconds.

panel convert dashboard.py --to pyodide-worker --out pyodide-worker

11:02:30.128 bokeh-3.4.3.min.js:185 [bokeh 3.4.3] setting log level to: 'info'
11:02:30.371 bokeh-3.4.3.min.js:166 [bokeh 3.4.3] document idle at 184 ms
11:02:30.417 fiveserver.js:1 [Five Server] connecting...
11:02:30.463 dashboard.js:12 Loading pyodide!
11:02:30.608 fiveserver.js:1 [Five Server] connected.
11:02:33.722 dashboard.js:16 Loaded!
11:02:33.729 pyodide.asm.js:9 Loading micropip, packaging
11:02:33.998 pyodide.asm.js:9 Loaded micropip, packaging
11:02:35.261 pyodide.asm.js:9 Loading Jinja2, MarkupSafe, xyzservices, pyyaml, contourpy, numpy, pandas, python-dateutil, six, pytz, Pillow
11:02:37.250 pyodide.asm.js:9 Loaded Jinja2, MarkupSafe, Pillow, contourpy, numpy, pandas, python-dateutil, pytz, pyyaml, six, xyzservices
11:02:38.050 pyodide.asm.js:9 packaging already loaded from default channel
11:02:38.050 pyodide.asm.js:9 six already loaded from default channel
11:02:38.054 pyodide.asm.js:9 Loading requests, charset-normalizer, idna, urllib3, certifi, bleach, webencodings, tqdm, typing-extensions
11:02:38.728 pyodide.asm.js:9 Loaded bleach, certifi, charset-normalizer, idna, requests, tqdm, typing-extensions, urllib3, webencodings
11:02:39.046 pyodide.asm.js:9 Loading pyodide-http
11:02:39.065 pyodide.asm.js:9 Loaded pyodide-http
11:02:39.394 pyodide.asm.js:9 Loading bitarray
11:02:39.436 pyodide.asm.js:9 Loaded bitarray
11:02:40.377 pyodide.asm.js:9 numpy already loaded from default channel
11:02:40.377 pyodide.asm.js:9 Loading scipy, openblas
11:02:44.072 pyodide.asm.js:9 Loaded openblas, scipy
11:02:44.704 dashboard.js:40 Packages loaded!
11:03:00.843 pyodide.asm.js:9 ### DEBUG ### python: 3.11.3 (main, Jan 18 2024, 19:07:12) [Clang 18.0.0 (https://github.com/llvm/llvm-project 75501f53624de92aafce2f1da698
11:03:00.846 pyodide.asm.js:9 ### DEBUG ### numpy: 1.26.1
11:03:00.852 pyodide.asm.js:9 ### DEBUG ### panel: 1.4.4
11:03:00.857 pyodide.asm.js:9 ### DEBUG ### bokeh: 3.4.3
11:03:00.861 pyodide.asm.js:9 ### DEBUG ### pandas: 1.5.3
11:03:03.441 bokeh-3.4.3.min.js:166 [bokeh 3.4.3] document idle at 164 ms

Here are the logs for 'pyodide'. It takes only 21 seconds.

panel convert dashboard.py --to pyodide

11:10:56.884 bokeh-3.4.3.min.js:185 [bokeh 3.4.3] setting log level to: 'info'
11:10:57.163 bokeh-3.4.3.min.js:166 [bokeh 3.4.3] document idle at 180 ms
11:10:57.208 fiveserver.js:1 [Five Server] connecting...
11:10:59.352 pyodide.asm.js:9 Loading micropip, packaging
11:10:59.428 fiveserver.js:1 [Five Server] connected.
11:10:59.586 pyodide.asm.js:9 Loaded micropip, packaging
11:11:01.014 pyodide.asm.js:9 packaging already loaded from default channel
11:11:01.019 pyodide.asm.js:9 Loading pyodide-http, bitarray, numpy, pandas, python-dateutil, six, pytz, scipy, openblas, Jinja2, MarkupSafe, xyzservices, Pillow, contourpy, pyyaml, requests, charset-normalizer, idna, urllib3, certifi, bleach, webencodings, tqdm, typing-extensions
11:11:05.472 pyodide.asm.js:9 Loaded Jinja2, MarkupSafe, Pillow, bitarray, bleach, certifi, charset-normalizer, contourpy, idna, numpy, openblas, pandas, pyodide-http, python-dateutil, pytz, pyyaml, requests, scipy, six, tqdm, typing-extensions, urllib3, webencodings, xyzservices
11:11:17.826 pyodide.asm.js:9 ### DEBUG ### python: 3.11.3 (main, Jan 18 2024, 19:07:12) [Clang 18.0.0 (https://github.com/llvm/llvm-project 75501f53624de92aafce2f1da698
11:11:17.829 pyodide.asm.js:9 ### DEBUG ### numpy: 1.26.1
11:11:17.834 pyodide.asm.js:9 ### DEBUG ### panel: 1.4.4
11:11:17.838 pyodide.asm.js:9 ### DEBUG ### bokeh: 3.4.3
11:11:17.840 pyodide.asm.js:9 ### DEBUG ### pandas: 1.5.3
@MarcSkovMadsen
Copy link
Collaborator

No this is not expected.

Could you try reproding the results with the xgboost reference example from the docs or providing us with another reproducible example?

@philippjfr
Copy link
Member

This is probably not unexpected and I was planning on making a final decision around this. Currently the pyodide target simply installs all packages at once, while the pyodide-worker target installs dependencies one-by-one so the user can be informed of the progress. The latter is seemingly considerably slower. This is already addressed in #6859 by foregoing the progress updates (among other changes).

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

No branches or pull requests

3 participants